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
commit93ce8560fa19c3a91de99643fdbbe4f895a47b84 (patch)
tree66a9e6f1bbbbd5a0a25c13a0e51e7a7c1225871c /Timeline/ClientApp/webpack.config.dev.js
parent6893a1c1e43b8fc17eaaba72db90494d946b5091 (diff)
downloadtimeline-93ce8560fa19c3a91de99643fdbbe4f895a47b84.tar.gz
timeline-93ce8560fa19c3a91de99643fdbbe4f895a47b84.tar.bz2
timeline-93ce8560fa19c3a91de99643fdbbe4f895a47b84.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,
+ }),
],
};