-
Notifications
You must be signed in to change notification settings - Fork 91
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
How to use this project in node.js? #861
Comments
After I add
And here is the code I used: `import { decode } from "@webassemblyjs/wasm-parser"; const decoderOpts = {}; const ast = decode("./test.wasm", decoderOpts);` |
The |
Many thanks for the help. I have already figured out this problem before. But a problem raises as #799 The WAT text form can't be parsed successfully. I guess maybe the WASM updates some new features. |
@chehx what is the parse failure you are seeing? |
Under my test mjs file is:
|
As the title claims, I meet some trouble with running this project in node.js.
`(node:12960) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
c:\Users\parserTest.js:3
import { decode } from "./node_modules/@webassemblyjs/wasm-parser";
^^^^^^
SyntaxError: Cannot use import statement outside a module
at wrapSafe (internal/modules/cjs/loader.js:1054:16)
at Module._compile (internal/modules/cjs/loader.js:1102:27)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
at Module.load (internal/modules/cjs/loader.js:986:32)
at Function.Module._load (internal/modules/cjs/loader.js:879:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47`
I also try to use this project in an HTML file, but it fails too.
Failed to load module script: The server responded with a non-JavaScript MIME type of "text/html". Strict MIME type checking is enforced for module scripts per HTML spec.
I try many times and read the issues and documents to solve this problem, but I failed.
Really hope you can help me to figure it out!
Thanks!
The text was updated successfully, but these errors were encountered: