Closed Summersby95 closed 1 year ago
Hi @Summersby95
The NodeParserAdapter
cannot run in a browser as it requires a Node.js runtime. It looks like we've made some mistakes in the packaging of NodeParserAdapter
, but even if we fixed that, it would never run in the browser.
I'm importing the NodeParserAdapter, not the WasmParserAdapter from the cucumber/language-service as we aren't using WebAssembly in our project.
You don't need to be using WebAssembly in your project. The Wasm code (compiled tree-sitter modules) are handled in an encapsulated way by the WasmParserAdapter
. All you need to do is to make the .wasm
files available to be downloaded.
👓 What did you see?
I'm trying to use the Monaco editor library in a React project which uses tree-sitter for Node ParserAdapter but when I'm getting a bunch of resolve errors in the tree-sitter when I do this. I'm importing the NodeParserAdapter, not the WasmParserAdapter from the cucumber/language-service as we aren't using WebAssembly in our project.
Environment: Node v16.17.1 (Docker Image 16.17)
Error Log:
Tree Sitter and the other tree-sitter-c-sharp, tree-sitter-java etc are all installed and in the node_modules directory of the project.
And when I look in the tree-sitter/build/Release I can see the tree_sitter_runtime_binding.node file
So why can't tree-sitter resolve it?
Have tried Node 18, that didn't work, tried running the build command directly from the node_modules/tree-sitter directory, didn't work, have tried installing tree-sitter in a new folder on it's own and getting the same error. Any help much appreciated.
✅ What did you expect to see?
The tree-sitter package to resolve correctly and for the Monaco editor to work with the @cucumber/monaco library.
📦 Which tool/library version are you using?
Node.js 16.17.1, tried with later versions of Node but to no success. React 18.2
🔬 How could we reproduce it?
Steps to reproduce the behavior:
Below is the code snippet I'm trying to run.
I tried following the example in the try folder, just replacing the WasmParserAdapter with the NodeParserAdapter but then I couldn't get any further with the resolve errors.
Any advice or help is much appreciated
📚 Any additional context?
Think I've gone through everything.