Upgrading an existing mix V2 project to V4, "yarn dev" hangs at 95% emitting.
$ webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js 95% emitting unnamed compat plugin
The manifest.json file indicates that vendor.js is being output twice, the second time with a path including the drive letter.
{
...
"/js/manifest.js": "/js/manifest.js",
"/js/vendor.js": "/js/vendor.js",
"/C:/js/vendor.js": "/C:/js/vendor.js"
}
If I remove the .extract(...) line from the mix file, the package seem to be built correctly, but obviously not chunked.
Here's my mix file.
let mix = require('laravel-mix');
mix.autoload({
'jquery': ['$', 'window.jQuery', 'jQuery'],
'popper.js': ['Popper']
});
mix
.ts('resources/assets/ts/app.ts', 'public/js')
.ts('resources/assets/ts/WebcentrePanel.ts', 'public/js')
.sass('resources/assets/css/helmpanel.scss', 'public/css')
.sass('resources/assets/css/webcentre.scss', 'public/css')
.extract(['hls.js', 'popper.js', 'bootstrap', 'jquery', 'urijs', 'xml2js', 'js-md5', 'tinycolor2', 'datatables.net'])
.copy('resources/assets/images/icon.svg', 'public')
.copy('resources/assets/images/icon.png', 'public')
.copy('resources/assets/images/logo-blue.svg', 'public')
.version();
Related to #1858 ?
i got same problem too
mix.webpackConfig({
output: {
filename: '[name].js',
chunkFilename: 'js/[name].js'
},
resolve: {
extensions: ['.js', '.vue', '.json'],
alias: {
'@': path.join(__dirname, './resources/assets/js')
}
}
})
mix.js('resources/assets/js/app.js', 'public/js')
.sass('resources/assets/sass/app.scss', 'public/css')
.disableNotifications()
.extract()
the mix-manifest.json goes as
{
"/js//js/app.js": "/js//js/app.js",
"/css/app.css": "/css/app.css",
"/js/manifest.js": "/js/manifest.js",
"/js//js/vendor.js": "/js//js/vendor.js",
"/js/basic.js": "/js/basic.js" // dynamic import file
}
@oommgg Exactly the same behaviour I have in my #1858.
@oommgg Your issue is related to you overriding the default output details. Let Mix be in charge of that.
@JeffreyWay let me know if you need help diagnosing this. Not everyone is "fortunate" enough to be using Windows for development ;)
@roddypratt Try to compile this:
let mix = require('laravel-mix');
mix.autoload({
'jquery': ['$', 'window.jQuery', 'jQuery'],
'popper.js': ['Popper']
});
mix
.ts('resources/assets/ts/app.ts', 'public/js')
.ts('resources/assets/ts/WebcentrePanel.ts', 'public/js')
.sass('resources/assets/css/helmpanel.scss', 'public/css')
.sass('resources/assets/css/webcentre.scss', 'public/css')
.extract(['hls.js', 'popper.js', 'bootstrap', 'jquery', 'urijs', 'xml2js', 'js-md5', 'tinycolor2', 'datatables.net'], 'js/vendor.js')
.copy('resources/assets/images/icon.svg', 'public')
.copy('resources/assets/images/icon.png', 'public')
.copy('resources/assets/images/logo-blue.svg', 'public')
.version();
The only difference is that I've set the second argument for mix.extract(), which specifies the output path for the vendor file. Does that change your compile or mix-manifest.json output?
I was working on exactly this issue yesterday, and this morning started to put together a minimal working example before noticing it had already been reported. I'm now encountering the same problem but in an even simpler scenario. I started with the simplest stand-alone project installation, added one dev dependency, and a minimal webpack.mix.js:
let mix = require('laravel-mix');
mix.js('src/app.js', 'dist');
Now it doesn't even get as far as the 95% emitting unnamed compat plugin error. Instead it just hangs immediately, with node using 100% of a CPU core for as long as I'll let it. The mix-manifest.json contains basically the same problem as in the original issue:
{
"/D:/dist/app.js": "/D:/dist/app.js"
}
Obviously those /D: entries shouldn't be there. Just for debugging purposes, I created an empty D:\dist directory to see whether anything would be created there, or if it would change the behaviour at all, but it didn't.
@JeffreyWay
No difference. and if I change the extract output path to js/wibble.js, I get this in the manifest.
"/js/wibble.js": "/js/wibble.js",
"/C:/js/wibble.js": "/C:/js/wibble.js"
Forgot to mention, the file /js/wibble.js is actually created and looks fairly sane, as was js/vendor.js
After further debugging, I've tracked the problem down to the normalizePath function in the Entry class. On Windows, the pathFromPublic is returning a value that begins with \, not /, so the public path is not correctly getting prepended. I can put together a PR that should hopefully resolve this.
Hmm... On further testing with my actual project, this still hasn't fixed the problem of hanging at 95%, though it did fix the invalid paths in the manifest for my (much simpler) test project. I'll keep debugging...
This should now be resolved as of 8449ee8. Thanks for a great tool, @JeffreyWay , looking forward to a new release!
@JeffreyWay @mikeu Thanks, both. 4.0.7 has resolved my issue but has moved me on to the next stumbling block... I'll open a new issue if I can create an MVCE.