@@ -3,8 +3,7 @@ const path = require('path'),
33 styleRules = require ( './styleLoaderConf' ) ,
44 CopyWebpackPlugin = require ( 'copy-webpack-plugin' ) ,
55 MiniCssExtractPlugin = require ( "mini-css-extract-plugin" ) ,
6- ManifestPlugin = require ( 'webpack-manifest-plugin' ) ,
7- SWPrecacheWebpackPlugin = require ( 'sw-precache-webpack-plugin' ) ;
6+ { GenerateSW} = require ( 'workbox-webpack-plugin' ) ;
87
98const DonePlugin = require ( './donePlugin' )
109const _PROD_ = process . env . NODE_ENV === 'production' ;
@@ -24,7 +23,7 @@ module.exports = {
2423 publicPath : '/' , // root Dir
2524 sourceMapFilename : '[name].map' ,
2625 chunkFilename : 'static/js/[name].[chunkhash:8].js' ,
27- filename : 'static/js/[name].[hash :8].js'
26+ filename : 'static/js/[name].[contenthash :8].js'
2827 } ,
2928
3029 resolveLoader : {
@@ -84,15 +83,15 @@ module.exports = {
8483 test : / \. ( e o t | w o f f | w o f f 2 | t t f ) ( \? \S * ) ? $ / ,
8584 loader : "url-loader" ,
8685 options : {
87- name : "assets/fonts/[name].[hash :8].[ext]" ,
86+ name : "assets/fonts/[name].[contenthash :8].[ext]" ,
8887 limit : 2048
8988 }
9089 } ,
9190 {
9291 test : / \. ( s v g | p n g | j p e ? g | g i f ) ( \? \S * ) ? $ / ,
9392 loader : "url-loader" ,
9493 options : {
95- name : "assets/imgs/[name].[hash :8].[ext]" ,
94+ name : "assets/imgs/[name].[contenthash :8].[ext]" ,
9695 limit : 2048
9796 }
9897 }
@@ -156,7 +155,7 @@ module.exports = {
156155 maxAsyncRequests : 5 ,
157156 maxInitialRequests : 3 ,
158157 automaticNameDelimiter : '~' ,
159- name : true ,
158+ // name: true,
160159 cacheGroups : {
161160 react : {
162161 name : 'vendor' ,
@@ -190,36 +189,39 @@ module.exports = {
190189 // },
191190 // _DEV_: JSON.stringify(_DEV_),
192191 // }),
193- new ManifestPlugin ( {
194- fileName : 'asset-manifest.json'
195- } ) ,
196- new SWPrecacheWebpackPlugin ( {
197- dontCacheBustUrlsMatching : / \. \w { 8 } \. / ,
198- filename : 'serviceWorker.js' ,
199- logger ( message ) {
200- console . log ( message ) ;
201- if ( message . indexOf ( 'Total precache size is' ) === 0 ) {
202- return ;
203- }
204- if ( message . indexOf ( 'Skipping static resource' ) === 0 ) {
205- return ;
206- }
207- } ,
208- minify : true ,
209- navigateFallback : '/index.html' ,
210- navigateFallbackWhitelist : [ / ^ (? ! \/ _ _ ) .* / ] ,
211- staticFileGlobsIgnorePatterns : [ / \. m a p $ / , / a s s e t - m a n i f e s t \. j s o n $ / ] ,
212- } ) ,
192+ // new GenerateSW(),
193+ // new ManifestPlugin({
194+ // fileName: 'asset-manifest.json'
195+ // }),
196+ // new SWPrecacheWebpackPlugin({
197+ // dontCacheBustUrlsMatching: /\.\w{8}\./,
198+ // filename: 'serviceWorker.js',
199+ // logger(message) {
200+ // console.log(message);
201+ // if (message.indexOf('Total precache size is') === 0) {
202+ // return;
203+ // }
204+ // if (message.indexOf('Skipping static resource') === 0) {
205+ // return;
206+ // }
207+ // },
208+ // minify: true,
209+ // navigateFallback: '/index.html',
210+ // navigateFallbackWhitelist: [/^(?!\/__).*/],
211+ // staticFileGlobsIgnorePatterns: [/\.map$/, /asset-manifest\.json$/],
212+ // }),
213213 new MiniCssExtractPlugin ( {
214214 filename : "static/css/[name].[contenthash].css" ,
215215 } ) ,
216216 new webpack . ProvidePlugin ( {
217217 $http : [ resolve ( 'src/utils/http.ts' ) , 'default' ] ,
218218 $msg : [ resolve ( 'node_modules/antd/es/message/index.js' ) , 'default' ]
219219 } ) ,
220- new CopyWebpackPlugin ( [ {
221- from : resolve ( 'statics' ) ,
222- ignore : [ '.*' ]
223- } ] )
220+ new CopyWebpackPlugin ( {
221+ patterns : [ {
222+ from : resolve ( 'statics' ) ,
223+ // ignore: ['.*']
224+ } ]
225+ } )
224226 ]
225227}
0 commit comments