@@ -21,7 +21,7 @@ let plugins = [
2121 'php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js' ,
2222 ] ,
2323 } ) ,
24- new MiniCssExtractPlugin ( { filename : 'bundle.[hash:8].css' } ) ,
24+ new MiniCssExtractPlugin ( { filename : isProduction ? 'bundle.[chunkhash:8].css' : 'bundle.[hash:8].css' } ) ,
2525 new AssetsManifestPlugin ( {
2626 writeToDisk : true ,
2727 publicPath : true ,
@@ -50,7 +50,7 @@ if (isProduction) {
5050 return content . match ( / [ A - z 0 - 9 -:\/ ] + / g) || [ ] ;
5151 }
5252 } ,
53- extensions : [ 'html' , 'js' , 'php' , 'vue' ] ,
53+ extensions : [ 'html' , 'ts' , ' js', 'php' , 'vue' ] ,
5454 } ,
5555 ] ,
5656 } ) ,
@@ -114,8 +114,8 @@ module.exports = {
114114 entry : [ './resources/assets/styles/main.css' , './resources/assets/scripts/app.ts' ] ,
115115 output : {
116116 path : path . resolve ( __dirname , 'public/assets' ) ,
117- filename : 'bundle.[hash:8].js' ,
118- chunkFilename : 'chunk.[ name].js',
117+ filename : isProduction ? 'bundle.[chunkhash:8].js' : 'bundle.[hash:8].js' ,
118+ chunkFilename : isProduction ? '[name].[chunkhash:8].js' : '[ name].[hash:8 ].js',
119119 publicPath : _ . get ( process . env , 'PUBLIC_PATH' , '' ) + '/assets/' ,
120120 crossOriginLoading : 'anonymous' ,
121121 } ,
@@ -125,6 +125,18 @@ module.exports = {
125125 test : / \. v u e $ / ,
126126 loader : 'vue-loader' ,
127127 } ,
128+ {
129+ test : / \. j s $ / ,
130+ loader : 'babel-loader' ,
131+ options : {
132+ cacheDirectory : ! isProduction ,
133+ presets : [ '@babel/preset-env' ] ,
134+ plugins : [
135+ '@babel/plugin-proposal-class-properties' ,
136+ [ '@babel/plugin-proposal-object-rest-spread' , { 'useBuiltIns' : true } ]
137+ ] ,
138+ } ,
139+ } ,
128140 {
129141 test : / \. t s $ / ,
130142 exclude : / n o d e _ m o d u l e s / ,
@@ -167,6 +179,25 @@ module.exports = {
167179 } ,
168180 } ) ,
169181 ] ,
182+ splitChunks : {
183+ cacheGroups : {
184+ vue : {
185+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] ( v u e \w ? ) [ \\ / ] / ,
186+ name : 'vue' ,
187+ chunks : 'initial' ,
188+ } ,
189+ locales : {
190+ test : / l o c a l e s / ,
191+ name : 'locales' ,
192+ chunks : 'initial' ,
193+ } ,
194+ vendors : {
195+ test : / [ \\ / ] n o d e _ m o d u l e s [ \\ / ] (? ! v u e ) ( .* ) [ \\ / ] / ,
196+ name : 'vendor' ,
197+ chunks : 'initial' ,
198+ } ,
199+ }
200+ }
170201 } ,
171202 devServer : {
172203 contentBase : path . join ( __dirname , 'public' ) ,
0 commit comments