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-29 00:14:00 +08:00
|
|
|
|
2021-05-13 00:29:18 +08:00
|
|
|
module.exports = {
|
2021-05-29 00:14:00 +08:00
|
|
|
webpack: {
|
|
|
|
plugins: [
|
|
|
|
new webpack.optimize.LimitChunkCountPlugin({
|
2021-08-07 05:04:28 +08:00
|
|
|
maxChunks: 1
|
2021-05-29 00:14:00 +08:00
|
|
|
}),
|
|
|
|
new MiniCssExtractPlugin({
|
|
|
|
filename: "static/bundle.css",
|
2021-08-07 05:04:28 +08:00
|
|
|
chunkFilename: "static/css/[name].chunk.css"
|
|
|
|
})
|
2021-05-29 00:14:00 +08:00
|
|
|
],
|
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 = {
|
2021-05-29 00:14:00 +08:00
|
|
|
splitChunks: {
|
|
|
|
cacheGroups: {
|
2021-08-07 05:04:28 +08:00
|
|
|
default: false
|
|
|
|
}
|
2021-05-29 00:14:00 +08:00
|
|
|
},
|
2021-08-07 05:04:28 +08:00
|
|
|
runtimeChunk: false
|
2021-10-27 00:58:47 +08:00
|
|
|
};
|
|
|
|
webpackConfig.entry = "./src/index";
|
|
|
|
webpackConfig.output = {
|
2021-06-04 03:07:40 +08:00
|
|
|
publicPath: "",
|
2021-10-28 02:49:14 +08:00
|
|
|
path: path.resolve(__dirname, "../gradio/templates/frontend"),
|
2021-05-29 00:14:00 +08:00
|
|
|
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-10-29 08:29:04 +08:00
|
|
|
}
|
2021-05-29 00:14:00 +08:00
|
|
|
},
|
2021-05-13 00:29:18 +08:00
|
|
|
style: {
|
|
|
|
postcss: {
|
2021-08-07 05:04:28 +08:00
|
|
|
plugins: [require("tailwindcss"), require("autoprefixer")]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
};
|