lezer-parser / yaml

YAML parser
MIT License
4 stars 2 forks source link

When I try to use the @codemirror/lang-yaml package, the console points to the @lezer/yaml package using static #1

Closed liutiyao closed 6 months ago

liutiyao commented 8 months ago
 error  in ./node_modules/@lezer/yaml/dist/index.js

Module parse failed: Unexpected token (44:13)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
|   }
| 
>   static top = new Context(null, -1, type_Top)
| }
| 

 @ ./node_modules/@codemirror/lang-yaml/dist/index.js 1:0-37 11:25-31

The static syntax is pretty advanced for this environment.Can @lezer/yaml be compiled when bundled into a dist file

marijnh commented 8 months ago

What tool is producing this error? Have you tried upgrading it?

simoami commented 7 months ago

Happened here too and compiled using react-scripts@4.0.3 and node 16. I experienced it after installing @uiw/codemirror-extensions-langs@4.21.24 Full error:

[react:testing     ] Compiling...
[react:testing     ] Failed to compile.
[react:testing     ]
[react:testing     ] ./node_modules/@lezer/yaml/dist/index.js 45:13
[react:testing     ] Module parse failed: Unexpected token (45:13)
[react:testing     ] File was processed with these loaders:
[react:testing     ]  * ./node_modules/react-scripts/node_modules/babel-loader/lib/index.js
[react:testing     ] You may need an additional loader to handle the result of these loaders.
[react:testing     ] |   }
[react:testing     ] |
[react:testing     ] >   static top = new Context(null, -1, type_Top);
[react:testing     ] | }
[react:testing     ] |
fasiha commented 6 months ago

Thank you for addressing this @marijnh 💙 forgive me for bothering you, I didn't see an updated version published in https://www.npmjs.com/package/@codemirror/lang-yaml?activeTab=versions, is there another version of one of the lezer or codemirror packages I should install to pick this up?

(In my case, my create-react-app complains:

/path/to/.pnpm/@codemirror+lang-yaml@6.1.1_@codemirror+view@6.26.3/node_modules/@codemirror/lang-yaml/dist/index.js
Module not found: Can't resolve '@lezer/lr' in '/path/to/.pnpm/@codemirror+lang-yaml@6.1.1_@codemirror+view@6.26.3/node_modules/@codemirror/lang-yaml/dist'
marijnh commented 5 months ago

I've tagged 1.0.3