-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error when using require to load an ES6 module #59
Comments
Hi @mackie1311 As usual any help is appreciated, otherwise I will try to work on that in the future. |
Thanks, @davideicardi I will set aside some time to look into this as well but for now, using CommonJS format and everything works great! I Will keep you posted |
Ciao @davideicardi, I quote all words from @mackie1311 you have done really a good job. I'm planning to use your package in some way to orchestate an extension manager for b3nab/deckpad. Probably you need to be aware that ESM now is getting traction and can be used without experimental flags at minimum Node.js 12.20, 14.14, or 16.0. If you want I could contribute to this package with a PR if I will find out a way. 😄 To help continue the discussion reagarding an improvement on live-plugin-manager interoperability with cjs and esm I will leave some interesting articles and links: |
Thank you for the info @b3nab . I will try to investigate on that. Pull requests are always welcome! |
I have done some investigation, and I can confirm that it should be possible to support ECMAScript Modules. I think that this will be a major release with no backward compatibility (or at least it can be difficult to be backward compatible...). Here the steps that I think we should do to implement it:
|
Hi, quoting @mackie1311, too :). Was there any progress on this? |
@christianhugoch Sorry, no news from me. I wasn't able to work on it. Any help is appreciated. |
Hi,
First off great NPM package by the way as well as your DI solution truly excellent work. Second, When I try to use the manager.require() method with my ES6 module I get the following error:
Cannot use import statement outside a module
If I install the package directly and use it with an import statement it works. I have check my package JSON sets the type to "module" which it does but I still get the error.
Is this intentional that import is not supported or is this a bug. Or am I doing something wrong here? Sample code block of my import attempt below
The install works but the line
const newPluginLib = this._manager.require(customPackage)
fails with the error above. I am going to try changing my files from .js to .mjs to see if that works and will report back. I would appreciate some info though as to whether this is supposed to work or not.Update:
I tried changing my ES6 module file types to .mjs and the live-plugin-manager failed with the following error:
Invalid javascript file
Thanks!,
The text was updated successfully, but these errors were encountered: