@@ -13,10 +13,12 @@ const pkg = require('./package.json');
1313module . exports = ( { production = false } = { } ) => {
1414 process . env . NODE_ENV = production ? 'production' : 'development' ;
1515
16- const path = resolve ( __dirname , './build' ) ;
16+ const output = {
17+ path : resolve ( __dirname , './build' ) ,
18+ filename : production ? '[name].[chunkhash].js' : '[name].js' ,
19+ chunkFilename : production ? '[name].[chunkhash].js' : '[name].js'
20+ } ;
1721 const include = resolve ( __dirname , './src' ) ;
18- const filename = production ? '[name].[chunkhash].js' : '[name].js' ;
19- const chunkFilename = filename ;
2022 const sourceMap = production ? 'cheap-module-source-map' : false ;
2123 const devtool = production ? 'cheap-module-source-map' : false ;
2224
@@ -31,8 +33,6 @@ module.exports = ({production = false} = {}) => {
3133
3234 const transform = c => c . toString ( ) . replace ( / F I R E B A S E _ C O N F I G / , defined . FIREBASE_CONFIG ) ;
3335
34- const minChunks = m => m . resource && m . resource . includes ( 'node_modules' ) ;
35-
3636 const minify = production ? {
3737 removeComments : true ,
3838 collapseWhitespace : true ,
@@ -49,7 +49,7 @@ module.exports = ({production = false} = {}) => {
4949 main : [ './src/main.js' ] ,
5050 vendor : [ 'react' , 'react-dom' , 'react-router' , 'material-ui' , 'firebase' ]
5151 } ,
52- output : { path , filename , chunkFilename } ,
52+ output,
5353 module : {
5454 loaders : [ {
5555 test : / \. ( j s | j s x ) $ / ,
@@ -65,8 +65,8 @@ module.exports = ({production = false} = {}) => {
6565 plugins : [
6666 new optimize . CommonsChunkPlugin ( {
6767 name : 'vendor' ,
68- filename,
69- minChunks
68+ output : output . filename ,
69+ minChunks : m => m . resource && m . resource . includes ( 'node_modules' )
7070 } ) ,
7171 new optimize . CommonsChunkPlugin ( {
7272 name : 'manifest' ,
@@ -93,7 +93,7 @@ module.exports = ({production = false} = {}) => {
9393 cacheId : `${ pkg . name } -${ pkg . version } ` ,
9494 stripPrefix : './build' ,
9595 staticFileGlobs : [
96- join ( path , '**/*' )
96+ join ( output . path , '**/*' )
9797 ] ,
9898 runtimeCaching : [ {
9999 urlPattern : / h t t p s : \/ \/ .+ .f i r e b a s e i o .c o m / ,
0 commit comments