diff options
author | crupest <crupest@outlook.com> | 2020-10-31 00:42:06 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-31 00:42:06 +0800 |
commit | a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f (patch) | |
tree | ee006874b0c93e9bfc76f141a092a8b9585a1f95 /FrontEnd/webpack.config.prod.js | |
parent | 0c4caaebe2480e77918d5d7df234f0edaeab74ba (diff) | |
parent | 7ce0846d9ec968da3ea4f7ebcc6db26db8e49089 (diff) | |
download | timeline-a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f.tar.gz timeline-a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f.tar.bz2 timeline-a3c97f6fb6313da2e8c0fac0b4c08f2ef4265d0f.zip |
Merge pull request #161 from crupest/upgrade
Upgrade packages and split front end and back end.
Diffstat (limited to 'FrontEnd/webpack.config.prod.js')
-rw-r--r-- | FrontEnd/webpack.config.prod.js | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/FrontEnd/webpack.config.prod.js b/FrontEnd/webpack.config.prod.js new file mode 100644 index 00000000..188cb940 --- /dev/null +++ b/FrontEnd/webpack.config.prod.js @@ -0,0 +1,53 @@ +const path = require("path");
+const { CleanWebpackPlugin } = require("clean-webpack-plugin");
+const CopyPlugin = require("copy-webpack-plugin");
+const WorkboxPlugin = require("workbox-webpack-plugin");
+const MiniCssExtractPlugin = require("mini-css-extract-plugin");
+
+const config = require("./webpack.common");
+
+config.mode("production");
+
+config
+ .entry("index")
+ .add(path.resolve(__dirname, "src/app/service-worker.tsx"));
+
+config.module
+ .rule("css")
+ .use("mini-css-extract")
+ .before("css")
+ .loader(MiniCssExtractPlugin.loader)
+ .end();
+
+config.module
+ .rule("sass")
+ .use("mini-css-extract")
+ .before("css")
+ .loader(MiniCssExtractPlugin.loader)
+ .end();
+
+config.devtool("source-map");
+
+config.plugin("mini-css-extract").use(MiniCssExtractPlugin);
+
+config.plugin("clean").use(CleanWebpackPlugin);
+
+config.plugin("copy").use(CopyPlugin, [
+ {
+ patterns: [
+ {
+ from: path.resolve(__dirname, "public/"),
+ to: path.resolve(__dirname, "dist/"),
+ },
+ ],
+ },
+]);
+
+config.plugin("workbox").use(WorkboxPlugin.InjectManifest, [
+ {
+ swSrc: path.resolve(__dirname, "src/sw/sw.ts"),
+ maximumFileSizeToCacheInBytes: 15000000,
+ },
+]);
+
+module.exports = config.toConfig();
|