-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
Worker Thread using VM to run code fails #56440
Comments
|
good thing I'm not using SourceTextModule... I'm using Source() or RunInContext, and both work with import just fine. That is they work fine when not run in a worker thread. The test case tests that the vm.(whatever) that I'm using actually worked with import in the first place... and
Both of those work just fine. (probalby don't need the option object on the runincontext |
What you see as "import" was dynamic import() that is available to the Scripts. The errors in the OP indicates that you are parsing static import statements which are not supported in Scripts and can only be parsed in a SourceTextModule. |
I see; the example still didn't use
Yes, does seem I can stay away from Thanks for the feedback @joyeecheung |
Version
23.5.0
Platform
Subsystem
No response
What steps will reproduce the bug?
I am working on using the VM module in worker_threads, and ran into an issue... I experimented a while to find a minimal case that would show me what I was missing... https://gist.github.com/d3x0r/c88e4cbadb37a3f4797ca40941ac3438 This is all of the approaches that I tried, and in the end I found
I tested all of the components of the above, the
vm.runInContext
works, thewt.Worker
works, but using vm.runInContext in wt.Worker fails...what I'm getting for an error in the application I'm developing this for I'm getting
which is a bad crash, what I get from the above example script is
it's possible there's a syntax error in the example, but I'm not seeing it... the quotes should be nested so it's a simple translation...
How often does it reproduce? Is there a required condition?
Always with the example script. I was also testing with
Script()
instead of VM and it was also failing.What is the expected behavior? Why is that the expected behavior?
vm and worker_thread can each use script code that can use
import
and is a module... but somehow vm IN worker_thread can't?What do you see instead?
(described above)
Additional information
No response
The text was updated successfully, but these errors were encountered: