elringus / bootsharp

Compile C# solution into single-file ES module with auto-generated JavaScript bindings and type definitions
https://sharp.elringus.com
MIT License
673 stars 36 forks source link

Interplatform compatibility? #134

Closed elringus closed 11 months ago

elringus commented 11 months ago

Discussed in https://github.com/elringus/bootsharp/discussions/133

Originally posted by **CADBIMDeveloper** January 6, 2024 Hi @elringus , Seems, I'm a bit annoying last days, sorry about that :-( I faced an issue when the code generated by bootsharp on Windows was not working on Linux raising the following error: ``` MONO_WASM: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file://dotnet.native.wasm' TypeError [ERR_INVALID_ARG_VALUE]: The argument 'filename' must be a file URL object, file URL string, or absolute path string. Received 'file://dotnet.native.wasm' at new NodeError (node:internal/errors:405:5) at Module.createRequire (node:internal/modules/cjs/loader:1493:13) ... ``` I believe it happens because different code is generated on Windows and Linux machines: On Windows: ```js ... .then((e=>e.createRequire("file://dotnet.native.wasm"))) ... ``` On Linux: ```js ... .then((e=>e.createRequire("file:///dotnet.native.wasm"))) ... ``` I solved it generating separated versions on Windows and Linux. I'm not sure if it can be fixed, it's probably came from `browser-wasm` workload. What do you think? Thank you!