aboutsummaryrefslogtreecommitdiff
path: root/Timeline/ClientApp/webpack.config.dev.js
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2020-06-11 17:27:15 +0800
committercrupest <crupest@outlook.com>2020-06-11 17:27:15 +0800
commitcf6cfe87b46a2a3eb2913209092ab4c5639e75c3 (patch)
treeeba7504d04dad89f67524b48d88a3b5eb27de6de /Timeline/ClientApp/webpack.config.dev.js
parent4b8abdd1921935ebb29d18961534db04a2e58fbb (diff)
downloadtimeline-cf6cfe87b46a2a3eb2913209092ab4c5639e75c3.tar.gz
timeline-cf6cfe87b46a2a3eb2913209092ab4c5639e75c3.tar.bz2
timeline-cf6cfe87b46a2a3eb2913209092ab4c5639e75c3.zip
feat(front): Service worker is coming!
Diffstat (limited to 'Timeline/ClientApp/webpack.config.dev.js')
-rw-r--r--Timeline/ClientApp/webpack.config.dev.js25
1 files changed, 22 insertions, 3 deletions
diff --git a/Timeline/ClientApp/webpack.config.dev.js b/Timeline/ClientApp/webpack.config.dev.js
index 12b25253..7a38f2b6 100644
--- a/Timeline/ClientApp/webpack.config.dev.js
+++ b/Timeline/ClientApp/webpack.config.dev.js
@@ -2,12 +2,14 @@ const path = require('path');
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
+const CopyPlugin = require('copy-webpack-plugin');
const PnpWebpackPlugin = require('pnp-webpack-plugin');
+const WorkboxPlugin = require('workbox-webpack-plugin');
const { commonRules, htmlCommonConfig } = require('./webpack.common');
const config = {
- entry: ['react-hot-loader/patch', './src/index.tsx'],
+ entry: ['react-hot-loader/patch', './src/app/index.tsx'],
mode: 'development',
devtool: 'eval-source-map',
module: {
@@ -53,7 +55,7 @@ const config = {
publicPath: '/',
},
devServer: {
- contentBase: path.join(__dirname, 'public/'),
+ contentBase: false,
host: '0.0.0.0',
port: 3000,
publicPath: 'http://localhost:3000/',
@@ -65,8 +67,25 @@ const config = {
...htmlCommonConfig,
devServer: 'http://localhost:3000',
}),
- new ForkTsCheckerWebpackPlugin(),
+ new CopyPlugin({
+ patterns: [
+ {
+ from: path.resolve(__dirname, 'public/'),
+ to: path.resolve(__dirname, 'dist/'),
+ },
+ ],
+ }),
+ new ForkTsCheckerWebpackPlugin({
+ tsconfig: './src/app/tsconfig.json',
+ }),
+ new ForkTsCheckerWebpackPlugin({
+ tsconfig: './src/sw/tsconfig.json',
+ }),
new webpack.HotModuleReplacementPlugin(),
+ new WorkboxPlugin.InjectManifest({
+ swSrc: './src/sw/sw.ts',
+ maximumFileSizeToCacheInBytes: 15000000,
+ }),
],
};