Extension needs to be declared as a type import #2
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "patch-1"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Without this, the build will include
Extensionin the output, which, when used with esm.run (or any other CDN), this theme loads a separate copy of@codemirror/state, which gets the error about instanceof checks with multiple states loaded.In general, type imports are a good signal to the compiler for stripping imports out during builds and help out humans know what the intend of imports are 🥳
Here is a reproduction of the problem being fixed: https://jsbin.com/sacumiraju/1/edit?html,output (currently only works in chrome due to import map support)
Extensionis already not imported indist/index.js, so this definitely won't help with loading a different copy of @codemirror/state (that happens through the import from @codemirror/view). Code style for this project is to just import things, regardless of whether they are type or other imports, and I don't see a compelling reason to change that.hmm -- how do we get codemirror to work via ESM CDNs?
Until they figure out how to properly deduplicate modules, you can't.
Pull request closed