diff options
author | crupest <crupest@outlook.com> | 2020-10-27 19:21:35 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2020-10-27 19:21:35 +0800 |
commit | 05ccb4d8f1bbe3fb64e117136b4a89bcfb0b0b33 (patch) | |
tree | 929e514de85eb82a5acb96ecffc6e6d2d95f878f /FrontEnd/webpack.config.prod.js | |
parent | 986c6f2e3b858d6332eba0b42acc6861cd4d0227 (diff) | |
download | timeline-05ccb4d8f1bbe3fb64e117136b4a89bcfb0b0b33.tar.gz timeline-05ccb4d8f1bbe3fb64e117136b4a89bcfb0b0b33.tar.bz2 timeline-05ccb4d8f1bbe3fb64e117136b4a89bcfb0b0b33.zip |
Split front 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();
|