symfony / stimulus-bridge

Stimulus integration bridge for Symfony projects
https://symfony.com/ux
75 stars 15 forks source link

VueJS - Could not retrieve module factory for type LoaderDependency #71

Closed jmariller closed 1 year ago

jmariller commented 2 years ago

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!

weaverryan commented 2 years ago

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?

jmariller commented 2 years ago

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 commented 1 year ago

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 commented 1 year ago

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

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