aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/webpack.config.prod.js
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-08-25 00:05:01 +0800
committerGitHub <noreply@github.com>2020-08-25 00:05:01 +0800
commit2867b65d2215ea89cca0e5c5cfbb536d08f60263 (patch)
tree07ae296c0c684fd81b30763ef9d6d27421de30b3 /Timeline/ClientApp/webpack.config.prod.js
parent4eb7a984e10d15fdb8ef988e1571b114fa74e420 (diff)
parent86e22ca4fb7dceec43a528bd250bcda2a0133421 (diff)
downloadtimeline-2867b65d2215ea89cca0e5c5cfbb536d08f60263.tar.gz
timeline-2867b65d2215ea89cca0e5c5cfbb536d08f60263.tar.bz2
timeline-2867b65d2215ea89cca0e5c5cfbb536d08f60263.zip
Merge pull request #154 from crupest/toolchain
Upgrade toolchain of front end.
Diffstat (limited to 'Timeline/ClientApp/webpack.config.prod.js')
-rw-r--r--Timeline/ClientApp/webpack.config.prod.js47
1 files changed, 32 insertions, 15 deletions
diff --git a/Timeline/ClientApp/webpack.config.prod.js b/Timeline/ClientApp/webpack.config.prod.js
index e3ef65e1..188cb940 100644
--- a/Timeline/ClientApp/webpack.config.prod.js
+++ b/Timeline/ClientApp/webpack.config.prod.js
@@ -1,34 +1,51 @@
-const path = require('path');
-const { CleanWebpackPlugin } = require('clean-webpack-plugin');
-const CopyPlugin = require('copy-webpack-plugin');
-const WorkboxPlugin = require('workbox-webpack-plugin');
+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');
+const config = require("./webpack.common");
-config.mode('production');
+config.mode("production");
config
- .entry('index')
- .add(path.resolve(__dirname, 'src/app/service-worker.tsx'));
+ .entry("index")
+ .add(path.resolve(__dirname, "src/app/service-worker.tsx"));
-config.devtool('source-map');
+config.module
+ .rule("css")
+ .use("mini-css-extract")
+ .before("css")
+ .loader(MiniCssExtractPlugin.loader)
+ .end();
-config.plugin('clean').use(CleanWebpackPlugin);
+config.module
+ .rule("sass")
+ .use("mini-css-extract")
+ .before("css")
+ .loader(MiniCssExtractPlugin.loader)
+ .end();
-config.plugin('copy').use(CopyPlugin, [
+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/'),
+ from: path.resolve(__dirname, "public/"),
+ to: path.resolve(__dirname, "dist/"),
},
],
},
]);
-config.plugin('workbox').use(WorkboxPlugin.InjectManifest, [
+config.plugin("workbox").use(WorkboxPlugin.InjectManifest, [
{
- swSrc: path.resolve(__dirname, 'src/sw/sw.ts'),
+ swSrc: path.resolve(__dirname, "src/sw/sw.ts"),
maximumFileSizeToCacheInBytes: 15000000,
},
]);