1+ const _ = require ( 'lodash' ) ;
12const path = require ( 'path' ) ;
23const tailwind = require ( 'tailwindcss' ) ;
34const glob = require ( 'glob-all' ) ;
@@ -8,8 +9,6 @@ const ExtractTextPlugin = require('extract-text-webpack-plugin');
89const ShellPlugin = require ( 'webpack-shell-plugin' ) ;
910const PurgeCssPlugin = require ( 'purgecss-webpack-plugin' ) ;
1011const UglifyJsPlugin = require ( 'uglifyjs-webpack-plugin' ) ;
11- const HTMLWebpackPlugin = require ( 'html-webpack-plugin' ) ;
12- const WebpackServeWaitpage = require ( 'webpack-serve-waitpage' ) ;
1312
1413// Custom PurgeCSS extractor for Tailwind that allows special characters in
1514// class names.
@@ -29,7 +28,7 @@ const basePlugins = [
2928 'php artisan ziggy:generate resources/assets/scripts/helpers/ziggy.js' ,
3029 ] ,
3130 } ) ,
32- new ExtractTextPlugin ( 'assets/ bundle.css' , {
31+ new ExtractTextPlugin ( 'bundle-[hash] .css' , {
3332 allChunks : true ,
3433 } ) ,
3534 new AssetsManifestPlugin ( {
@@ -38,10 +37,6 @@ const basePlugins = [
3837 integrity : true ,
3938 integrityHashes : [ 'sha384' ] ,
4039 } ) ,
41- new HTMLWebpackPlugin ( {
42- template : './resources/assets/index.html' ,
43- filename : 'index.html' ,
44- } )
4540] ;
4641
4742const productionPlugins = [
@@ -77,9 +72,9 @@ module.exports = {
7772 // Passing an array loads them all but only exports the last.
7873 entry : [ './resources/assets/styles/main.css' , './resources/assets/scripts/app.js' ] ,
7974 output : {
80- path : path . resolve ( __dirname , 'public' ) ,
81- filename : 'assets/ bundle.js' ,
82- publicPath : ' /',
75+ path : path . resolve ( __dirname , 'public/assets ' ) ,
76+ filename : 'bundle-[hash] .js' ,
77+ publicPath : _ . get ( process . env , 'PUBLIC_PATH' , '' ) + '/assets /',
8378 crossOriginLoading : 'anonymous' ,
8479 } ,
8580 module : {
@@ -133,19 +128,16 @@ module.exports = {
133128 } ,
134129 plugins : process . env . NODE_ENV === 'production' ? basePlugins . concat ( productionPlugins ) : basePlugins ,
135130 serve : {
136- host : "0.0.0.0" ,
137131 content : "./public/" ,
138132 dev : {
139- publicPath : "/"
140- } ,
141- hot : {
142- host : {
143- server : "0.0.0.0" ,
144- client : "192.168.50.2"
133+ publicPath : "/assets/" ,
134+ headers : {
135+ "Access-Control-Allow-Origin" : "*" ,
145136 }
146137 } ,
147- add ( app , middleware , options ) {
148- app . use ( WebpackServeWaitpage ( options , { theme : 'dark' } ) ) ;
138+ hot : {
139+ hmr : true ,
140+ reload : true ,
149141 }
150142 }
151143} ;
0 commit comments