Closed allain closed 1 year ago
What's going on is you submitted a completely broken patch, I didn't look at it closely enough, and put out a broken release, so I reverted it.
Sure. My apologies. Figured a one line change with passing tests it would be safe.
The tests don't load the rollup plugin.
What might help is if you describe your actual problem. "generator not importable from esm module" isn't very clear, especially since this change was to the rollup plugin, not the generator library.
I think I encountered the same problem with you. It prevents me from using the generator for rollup as a vite plugin.
Since it seems this problem relates to rollup@3, which vite relies on, we can reproduce it just by updating the major version of rollup within codemirror/lang-example
:
git clone https://github.com/codemirror/lang-example
cd lang-example/
npm i
npm install rollup@3 # ^3.19.1
and then run :
npm run prepare
Output of the last command:
> codemirror-lang-EXAMPLE@0.1.0 prepare
> rollup -c
[!] Error: Directory import '/private/tmp/lang-example/node_modules/@lezer/generator/' is not supported resolving ES modules imported from /private/tmp/lang-example/node_modules/@lezer/generator/dist/rollup-plugin-lezer.js
file:///private/tmp/lang-example/node_modules/@lezer/generator/
Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/private/tmp/lang-example/node_modules/@lezer/generator/' is not supported resolving ES modules imported from /private/tmp/lang-example/node_modules/@lezer/generator/dist/rollup-plugin-lezer.js
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:224:17)
at moduleResolve (node:internal/modules/esm/resolve:850:10)
at defaultResolve (node:internal/modules/esm/resolve:1058:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:416:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
at link (node:internal/modules/esm/module_job:75:36)
Attached patch adjusts the build script to explicitly rename this import, but only in the ES output, avoiding the breakage caused by the previous patch.
Same reason as before. (esm doesn't support importing from directories). I saw you rolled it back.
What's going on?