diff options
author | crupest <crupest@outlook.com> | 2020-08-25 00:05:01 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-25 00:05:01 +0800 |
commit | 738a17688ca481db62755295f8b732200ca12511 (patch) | |
tree | 034b470eff54a9f725cd9e472966cf554cd2ee26 /Timeline/ClientApp/webpack.config.prod.js | |
parent | b9b7334ac5d5cf83b6206af024ddd4c55a6e07da (diff) | |
parent | fe687f82d9c5af2869b679222bec11b1a00b9ee9 (diff) | |
download | timeline-738a17688ca481db62755295f8b732200ca12511.tar.gz timeline-738a17688ca481db62755295f8b732200ca12511.tar.bz2 timeline-738a17688ca481db62755295f8b732200ca12511.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.js | 47 |
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,
},
]);
|