-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[WASM] Adding a new switch to run wasm on NodeJS #54640
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
Conversation
|
Tagging subscribers to this area: @CoffeeFlux Issue DetailsWORK IN PROGRESSThis PR adds the missing pieces for NodeJS support to MONO WASM! How does it workThe main differences between this and running the console sample regularly in v8 is that dotnet.js is modularized so we use These changes are triggered by specifying How to run locally
TODO LIST
|
It will be used in Daniel's dotnet/runtime#54640
|
For organizational purposes here is a list of the main test failures(I'll update as I progress):
|
|
Most of the CI issues right now are caused by the issue that the runfoapp bot reported (#55449) |
|
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
I just found where the NodeJS and NPM are set for the build machines. Turns out that the |
|
@terrajobst I am an intern on @lewing 's team. So I am internal to MSFT :). |
Sorry, you didn't show up as an FTE on GitHub. No worries :-) |
f84e585 to
06d2a29
Compare
|
The current test failures are caused by having an old version of Node on Helix which don't support the newly added Update: As part of my testing for this I found that the minimum supported version of Node is the current LTS (v14) |
|
The current idea is if we need to use node (i.e. Originally the idea (attempt 1) was to download from https://nodejs.org/dist/latest-v14.x/node-v14.17.4-linux-x64.tar.xz but the download system only supports zip files. So using emsdk should get around this while having the added benefit of also keeping the version of node synced with that of emdsk. Maybe after this works we can find a way to strip out node from the emsdk directory instead of sending the whole thing. |
3b49141 to
48f902c
Compare
|
/azp run runtime |
|
Commenter does not have sufficient privileges for PR 54640 in repo dotnet/runtime |
|
/azp run runtime |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
|
|
I'm thinking that the issues with old NodeJs and FinalizationRegtistry/WeakRef could be now OK, as we made them optional. |
945d2a5 to
14f7c05
Compare
14f7c05 to
8600ffc
Compare
This PR adds the missing pieces for NodeJS support to MONO WASM!
How does it work
The main differences between this and running the console sample regularly in v8 is that dotnet.js is modularized so we use
requireto load it. We now also have apackage.jsonandpackage-lock.jsonfiles as well as thenode_modulesfolder. Besides that, most changes to the code were related to various NodeJS related nuances such as the scoping ofthisbut are ignored by the browser.These changes are triggered by specifying
/p:ForNode=truewhen building and publishing. If this switch is not specified then it is false.What has changed
/p:ForNode=trueswitch to toggle the extra steps needed for the NodeJS buildNodeJSengine, so now when running tests we can use the/p:JSEngine=NodeJSswitchHow to run locally
./build.cmd mono+libs -os Browser -c Debug /p:ForNode=true(-c Releasealso works)./dotnet.cmd publish /p:TargetArchitecture=wasm /p:TargetOS=Browser /p:ForNode=true .\src\mono\sample\wasm\console\Wasm.Console.Sample.csproj -c Debugcd src\mono\sample\wasm\console\bin\Debug\AppBundlenpm test,./run-node.sh(orrun-node.cmdif on windows) ornode runtime.js --run Wasm.Console.Sample.dllNote: If you want to run tests locally via XHarness, you will need to also include
/p:JSEngine=NodeJSin that command.TODO LIST
node --trace-warnings runtime.js --run Wasm.Console.Sample.dllpackage.jsonfile and runnpm installon itModularizeflag based on the new switchSample of how it can be used
https://github.com/Daniel-Genkin/runtime/tree/wasm-node-demo/src/mono/sample/wasm/console-node