Closed PrOpOvEdNiK closed 3 years ago
Interesting, I'll look into this in the coming days. In the meantime if you want to help:
3.6.0
is working correctly can you try all of the versions between 3.6.0
and 3.7.1
?npm install
and start to debug the issue so if you have time to provide this that'd be awesomeTook some time trying to debug this but I can't get the repository to run. First it has an invalid version in package.json
but even after fixing that I'm running into command not found: mix
errors. Keep in mind that I have never used Laravel Mix so I have no idea what I'm doing, I was hoping to be able to run npm start
or npm run build
and see the problem occur so this isn't helping me much.
The stacktrace in one of the previous messages includes references to the SplitChunksPlugin but the tests regarding that plugin seem to be running without any issues and I can't seem to reproduce it any other way.
So please update the repo in such a way that running npm start
actually triggers the problem and I can look into it again.
Sorry, I forgot to write how to run it.
After npm install
you can run npm run dev
or npm run prod
or just npx mix
. This take the same effect.
I fixed the version to 3.7.1 and checked again - the problem repeats.
Just checked it out again, ran into the same invalid version
in package.json
:
$ npm run dev
npm ERR! Invalid version: "1.0"
Apparently that was also preventing the npm dependencies from getting installed so I'm now able to reproduce the issue after fixing the value in package.json
.
It's probably just the package name, not version. Name "laravel-mix" conflict with original package. Just change it. It's strange that I had no problem with it. omg... shame on me
It's definitely the version, according to the spec the version should be parseable by the semver
package and '1.0'
is not. I fixed it by changing it to '1.0.0'
in package.json
.
Version must be parseable by node-semver, which is bundled with npm as a dependency. (
npm install semver
to use it yourself.)
I can image you're using Yarn and there might be other rules.
With regards to the problem it might indeed be a problem in this plugin. The fact that you're using mix.sass()
enables the Sass preprocessor available in laravel-mix which in turn adds tests for certain chunks and ultimately we end up in this method which causes the error to be thrown.
The line in question checks for module.issuer
and then fails on the module that was added by this plugin because apparently the module's issuer isn't in the ModuleGraph for some reason. I'll continue investigating 🕵🏼
I'm not 100% sure this problem can be fixed in this plugin, it was quite a rabbit hole to say the least...
Module.issuer
is deprecated in Webpack 5 and should be replaced by something like compilation.moduleGraph.getIssuer(module)
.module.issuer
(e.g. to compilation.modules.values().next().value
which is the first module in the compilation) as a workaround but this in itself throws the same error because it triggers the setter.
ModuleGraph.getModuleGraphForModule().setIssuer()
which would translate to compilation.moduleGraph.setIssuer()
and setting that to the first module in the compilation as explained in point 3 doesn't solve the problem because it sets the issuer in the Module Graph, not on the module itself which is what laravel-mix is looking at.So to conclude, IMO the code in laravel-mix should be updated to use the new ModuleGraph, they might have a plan for that since laravel-mix isn't stable yet w.r.t. Webpack 5 support yet. Feel free to create an issue on their side and reference this thread. I'm closing this one and am definitely open for a further discussion if any ideas for workarounds pop up.
@PrOpOvEdNiK I'm running into this issue now. Did you find a workaround, or discuss with @JeffreyWay?
@danielbachhuber no. We had rollback to the laravel-mix 5 in projects where there is svg-spritemap-webpack-plugin
Thanks @PrOpOvEdNiK. I've opened a Laravel Mix issue about it: https://github.com/JeffreyWay/laravel-mix/issues/2767
@PrOpOvEdNiK This will be fixed in the next tagged release of Laravel Mix https://github.com/JeffreyWay/laravel-mix/pull/2768
@danielbachhuber It's great! Thanks for taking care about this!
I use laravel-mix. After switch to 6.0.0-beta release #webpack5 patch was very helpful and worked well for me. Thx) Now I'm upgrade plugin to v3.7.1 and get this error.
To reproduce package.json
webpack.mix.js
Full error text