Skip to content
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

Work around vercel/ncc import issues #3329

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kewisch
Copy link
Contributor

@kewisch kewisch commented Jan 5, 2025

Here is a workaround so web-ext compiles with vercel's ncc. It doesn't like dynamic imports, but will happily ignore them if indirect. Any chance you'd accept this patch?

See vercel/ncc#935 for details.

Copy link
Member

@Rob--W Rob--W left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a hack to work around ncc. We're not in favor of such a hack.

The purpose of the code here is to evaluate a config file as JS code and use its result. The use of nonce shows that import() is not exactly the perfect API here, because of its module caching behavior.

We are willing to consider non-hacky alternatives, such as logic that uses the vm module to execute code (https://nodejs.org/api/vm.html).

@kewisch
Copy link
Contributor Author

kewisch commented Feb 5, 2025

I think vm might not work without --experimental-vm-modules for ESM config files, but I'll see if there is another way to solve this. Let me know if you have ideas!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants