gradio/frontend/craco.config.js

46 lines
1.2 KiB
JavaScript
Raw Normal View History

2021-08-07 05:04:28 +08:00
const path = require("path");
const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
2021-05-13 00:29:18 +08:00
module.exports = {
webpack: {
plugins: [
new webpack.optimize.LimitChunkCountPlugin({
2021-08-07 05:04:28 +08:00
maxChunks: 1
}),
new MiniCssExtractPlugin({
filename: "static/bundle.css",
2021-08-07 05:04:28 +08:00
chunkFilename: "static/css/[name].chunk.css"
})
],
2021-08-07 05:04:28 +08:00
eslint: {
enable: true /* (default value) */,
mode: "extends" /* (default value) */ || "file"
},
2021-10-27 00:58:47 +08:00
configure: (webpackConfig, { env, paths }) => {
webpackConfig.optimization = {
splitChunks: {
cacheGroups: {
2021-08-07 05:04:28 +08:00
default: false
}
},
2021-08-07 05:04:28 +08:00
runtimeChunk: false
2021-10-27 00:58:47 +08:00
};
webpackConfig.entry = "./src/index";
webpackConfig.output = {
publicPath: "",
path: path.resolve(__dirname, "../gradio/templates/frontend"),
filename: "static/bundle.js",
2021-08-07 05:04:28 +08:00
chunkFilename: "static/js/[name].chunk.js"
2021-10-27 00:58:47 +08:00
};
paths.appBuild = webpackConfig.output.path;
return webpackConfig;
}
},
2021-05-13 00:29:18 +08:00
style: {
postcss: {
2021-08-07 05:04:28 +08:00
plugins: [require("tailwindcss"), require("autoprefixer")]
}
}
};