stimulus-bridge icon indicating copy to clipboard operation
stimulus-bridge copied to clipboard

VueJS - Could not retrieve module factory for type LoaderDependency

Open jmariller opened this issue 3 years ago • 3 comments

Hi,

I am trying to use Stimulus with VueJS, unfortunately I always get the same error message during compilation:

Could not retrieve module factory for type LoaderDependency

Here is an extract of package.json: image

webpack.config.js: image

And the full error message: image

I suspect this has to do with the different versions of Webpack - I tried to remove the dependencies from package.json, but then got this error message: image

Does anybody have a similar issue, and a possible solution?

Thanks!

jmariller avatar Jun 09 '22 13:06 jmariller

Hmm. This is from a complex workaround in https://github.com/symfony/stimulus-bridge/blob/4204b399dfca85f209af38f3f5184fadcf4bbd23/src/webpack/loader.ts#L31-L39 ... a workaround we also use in Encore, and I can't find any issues there about it.

Does the error go away if you disable the vue loader?

weaverryan avatar Jun 14 '22 19:06 weaverryan

Hi @weaverryan, thanks a lot for getting back to me!

Does the error go away if you disable the vue loader?

Not completely sure what you mean with disable, I take it you imply removing it from package.json. If so, here is the result when trying to compile: image

jmariller avatar Jun 15 '22 13:06 jmariller

Hi @weaverryan

After further investigation and trying with a fresh project I noticed that the problem seems to be related to Yarn (with PnP mode enabled): when installing & compiling with NPM it works fine. Do you have any idea why?

jmariller avatar Jul 12 '22 11:07 jmariller

This is resolved thanks to Webpack 4.0 :) Thank you!

https://github.com/symfony/webpack-encore/releases/tag/v4.0.0

jmariller avatar Sep 15 '22 13:09 jmariller