laravel-elixir-webpack-official
laravel-elixir-webpack-official copied to clipboard
webpack code splitting: base app.js is only built with gulp --production
I'm having trouble getting split js files to compile correctly. Everything works OK when I run gulp --production , but when I run gulp without --production , the base app.js is not compiled. The split modules are compiled OK to 0.app.js , 1.app.js etc . But the base app.js is simply missing.
My gulpfile:
const elixir = require('laravel-elixir');
require('laravel-elixir-vue');
var webpack = require('webpack');
elixir(mix => {
mix.sass('app.scss')
.webpack('app.js', 'public/js');
mix.version('css/app.css');
});
Elixir.webpack.mergeConfig({
module: {
loaders: [
{
test: /\.svg$/,
loader: 'file',
},
{
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
},
],
},
output: {publicPath: "/js/", filename: "app.js"},
resolve: {
alias: {
vue: 'vue/dist/vue.js'
}
},
});
Does anyone have any idea what's up with this?
I'm having the exact same issue, any clues so far? I tried running webpack directly and it generated the all the files correctly, so the issue is probably not webpack-specific.
No, I'm still stuck running --production every time I need to compile. I'll post back here if I come up with anything.
@tripper54 , thanks, you solved my issue of app.js trying to look for 0.app.js file in localhost/ rather than localhost/js
output: {publicPath: "/js/", filename: "app.js"},
This line specifically!
@tripper54 , I found that after upgrading nodejs to 6 and reinstalling all the modules everything went back to working as a charm on 2 different environments. I had by dev environments built long time ago and I overlooked this detail, I had node 5.6 for some reason. Hope this helps