From cab7a278030af214f0503fa705d2015661a9ac4d Mon Sep 17 00:00:00 2001 From: crupest Date: Thu, 11 Jun 2020 23:28:25 +0800 Subject: build(front): Not use service worker in development mode. --- Timeline/ClientApp/src/app/index.tsx | 2 -- Timeline/ClientApp/webpack.config.dev.js | 16 +--------------- Timeline/ClientApp/webpack.config.prod.js | 2 +- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/Timeline/ClientApp/src/app/index.tsx b/Timeline/ClientApp/src/app/index.tsx index ff874c45..086bd6e8 100644 --- a/Timeline/ClientApp/src/app/index.tsx +++ b/Timeline/ClientApp/src/app/index.tsx @@ -13,5 +13,3 @@ import './i18n'; import App from './App'; ReactDOM.render(, document.getElementById('app')); - -import './service-worker'; diff --git a/Timeline/ClientApp/webpack.config.dev.js b/Timeline/ClientApp/webpack.config.dev.js index 7a38f2b6..c2f29700 100644 --- a/Timeline/ClientApp/webpack.config.dev.js +++ b/Timeline/ClientApp/webpack.config.dev.js @@ -2,9 +2,7 @@ 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'); @@ -55,7 +53,7 @@ const config = { publicPath: '/', }, devServer: { - contentBase: false, + contentBase: path.resolve(__dirname, 'public/'), host: '0.0.0.0', port: 3000, publicPath: 'http://localhost:3000/', @@ -67,14 +65,6 @@ const config = { ...htmlCommonConfig, devServer: 'http://localhost:3000', }), - new CopyPlugin({ - patterns: [ - { - from: path.resolve(__dirname, 'public/'), - to: path.resolve(__dirname, 'dist/'), - }, - ], - }), new ForkTsCheckerWebpackPlugin({ tsconfig: './src/app/tsconfig.json', }), @@ -82,10 +72,6 @@ const config = { tsconfig: './src/sw/tsconfig.json', }), new webpack.HotModuleReplacementPlugin(), - new WorkboxPlugin.InjectManifest({ - swSrc: './src/sw/sw.ts', - maximumFileSizeToCacheInBytes: 15000000, - }), ], }; diff --git a/Timeline/ClientApp/webpack.config.prod.js b/Timeline/ClientApp/webpack.config.prod.js index 3b74faf6..e4594421 100644 --- a/Timeline/ClientApp/webpack.config.prod.js +++ b/Timeline/ClientApp/webpack.config.prod.js @@ -9,7 +9,7 @@ const WorkboxPlugin = require('workbox-webpack-plugin'); const { commonRules, htmlCommonConfig } = require('./webpack.common'); const config = { - entry: ['./src/app/index.tsx'], + entry: ['./src/app/index.tsx', './src/app/service-worker.tsx'], mode: 'production', devtool: 'source-map', module: { -- cgit v1.2.3