Work around vercel/ncc import issues#3329
Conversation
Rob--W
left a comment
There was a problem hiding this comment.
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).
|
I think |
|
readFile + eval (maybe with source map comment to attribute the file correctly if there is an error in it)? |
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.