Open phoenix-ru opened 3 years ago
Hi @phoenix-ru , thanks for raising an issue. I agree that plugin injected code should depend on the module format. Will take a look.
Thank you for your answer, and by the way, I managed to solve it using unjs/mlly which shims the commonjs specifics in es modules. But it would be very nice to see it work out of the box without the need to inject this hack to the generated code 😃
Is there a way to generate code which is compatible with ES5? Currently the code generated by the plugin uses
require
to linkhttp(s)
,vm
, etc. even when module output is explicitly enabled (output.module
,experiments.outputModule
,output.libraryTarget
,output.chunkFormat
, etc.). I believe that it is not a correct behaviour, asrequire
is not available in the module context. On top of that, the plugin also usesexports
,__dirname
and similar globals, which is also problematic.The reason that modules support is needed is that new Nuxt 3 uses modules output format and our company is interested in integrating Nuxt and Module Federation. I am willing to work on adding this feature to the plugin if my help is needed.