File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed
Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,7 @@ function clientConfig(env) {
9595function isProd ( config ) {
9696 let limit = 200 * 1000 ; // 200kb
9797
98- return {
98+ const prodConfig = {
9999 performance : {
100100 hints : 'warning' ,
101101 maxAssetSize : limit ,
@@ -139,6 +139,14 @@ function isProd(config) {
139139 ]
140140 }
141141 } ) ,
142+ new webpack . DefinePlugin ( {
143+ 'process.env.ADD_SW' : config . serviceWorker
144+ } ) ,
145+ ]
146+ } ;
147+
148+ if ( config . serviceWorker ) {
149+ prodConfig . plugins . push (
142150 new SWPrecacheWebpackPlugin ( {
143151 filename : 'sw.js' ,
144152 navigateFallback : 'index.html' ,
@@ -153,11 +161,10 @@ function isProd(config) {
153161 / \. g i t /
154162 ]
155163 } ) ,
156- new webpack . DefinePlugin ( {
157- 'process.env.ADD_SW' : config . serviceWorker
158- } ) ,
159- ]
160- } ;
164+ ) ;
165+ }
166+
167+ return prodConfig ;
161168}
162169
163170function isDev ( config ) {
You can’t perform that action at this time.
0 commit comments