Add --experimental-vm-modules flag to bin/harper#237
Conversation
|
I am really curious how to reproduce this? |
|
I ran P.S. I'm working on fixing the tests. |
|
Oh, I see, this is because extension modules are running on the main thread. I think this is root issue, and we should look at preventing this altogether. |
| @@ -1,4 +1,4 @@ | |||
| #!/usr/bin/env node | |||
| #!/usr/bin/env node --experimental-vm-modules | |||
There was a problem hiding this comment.
I think the correct syntax is:
#!/usr/bin/env -S node --experimental-vm-modules
But I have no idea if that is really cross-platform/OS safe.
There was a problem hiding this comment.
-S isn't strictly necessary if there's only a single argument.
| }); | ||
|
|
||
| // If not safe mode, components are loaded on the main thread which requires VM modules to be enabled | ||
| if (!process.env.HARPER_SAFE_MODE && !process.execArgv.includes('--experimental-vm-modules')) { |
There was a problem hiding this comment.
I think we want to disable VM loading in jsLoader.ts when this condition occurs, not exit.
There was a problem hiding this comment.
I hear you. This is a toughy. If you run node dist/bin/harper.js, then it will have different behavior than if you run harper via npm or global link.
|
I will update this PR to:
|
When running
harper devfrom an app, it throws the following:The problem is
vm.SourceTextModuleis only available when--experimental-vm-modulesis set. This flag is set when the worker is started, however the components (e.g. my app) is loaded on the main thread before start worker is called.