@@ -117,21 +117,24 @@ const buildConfig = baseConfig.clone()
117117 chunks : [ 'gui' ] ,
118118 template : 'src/playground/index.ejs' ,
119119 title : 'Smalruby' ,
120- originTrials : JSON . parse ( fs . readFileSync ( path . resolve ( __dirname , 'origin-trials.json' ) ) )
120+ originTrials : JSON . parse ( fs . readFileSync ( 'origin-trials.json' ) ) ,
121+ pwa : process . env . NODE_ENV === 'production'
121122 } ) )
122123 . addPlugin ( new HtmlWebpackPlugin ( {
123124 chunks : [ 'gui' ] ,
124125 template : 'src/playground/index.ejs' ,
125126 filename : 'ja.html' ,
126127 title : 'スモウルビー' ,
127- originTrials : JSON . parse ( fs . readFileSync ( path . resolve ( __dirname , 'origin-trials.json' ) ) )
128+ originTrials : JSON . parse ( fs . readFileSync ( 'origin-trials.json' ) ) ,
129+ pwa : process . env . NODE_ENV === 'production'
128130 } ) )
129131 . addPlugin ( new HtmlWebpackPlugin ( {
130132 chunks : [ 'player' ] ,
131133 filename : 'player.html' ,
132134 template : 'src/playground/index.ejs' ,
133135 title : 'Smalruby: Player Example' ,
134- originTrials : JSON . parse ( fs . readFileSync ( path . resolve ( __dirname , 'origin-trials.json' ) ) )
136+ originTrials : JSON . parse ( fs . readFileSync ( 'origin-trials.json' ) ) ,
137+ pwa : process . env . NODE_ENV === 'production'
135138 } ) )
136139 . addPlugin ( new CopyWebpackPlugin ( {
137140 patterns : [
@@ -145,7 +148,9 @@ const buildConfig = baseConfig.clone()
145148 context : 'src/examples'
146149 }
147150 ]
148- } ) )
151+ } ) ) ;
152+
153+ const buildWithPwaConfig = buildConfig . clone ( )
149154 . addPlugin (
150155 new WorkboxPlugin . GenerateSW ( {
151156 disableDevLogs : ! process . env . DEBUG ,
@@ -188,5 +193,5 @@ const buildConfig = baseConfig.clone()
188193const buildDist = process . env . NODE_ENV === 'production' || process . env . BUILD_MODE === 'dist' ;
189194
190195module . exports = buildDist ?
191- [ buildConfig . get ( ) , distConfig . get ( ) ] :
196+ [ buildWithPwaConfig . get ( ) , distConfig . get ( ) ] :
192197 buildConfig . get ( ) ;
0 commit comments