Error: Unrecognized extension value in extension set ([object Object]) #3

Closed
opened 2021-08-14 15:30:36 +02:00 by Azorlogh · 6 comments
Azorlogh commented 2021-08-14 15:30:36 +02:00 (Migrated from github.com)

Hi, I followed the README in this repo and follow this tutorial to bundle codemirror with rollup.

However, when I replace the lang-javascript package with my own, I get the following error:

Uncaught Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks.

It happens without changing lang-example at all, and all the tests pass.

I made sure to use compatible versions of the @codemirror/x packages (tried originally with 0.18.x, and updated to 0.19.x), but the issue persists.

Hi, I followed the README in this repo and follow [this tutorial to bundle codemirror with rollup](https://codemirror.net/6/examples/bundle/). However, when I replace the lang-javascript package with my own, I get the following error: ``` Uncaught Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks. ``` It happens without changing lang-example at all, and all the tests pass. I made sure to use compatible versions of the @codemirror/x packages (tried originally with 0.18.x, and updated to 0.19.x), but the issue persists.
marijnh commented 2021-08-15 09:04:17 +02:00 (Migrated from github.com)

Did you check whether multiple instances of @codemirror/state are installed? Even when your package.json is entirely reasonable, npm will sometimes upgrade an existing install in a way that needlessly duplicates packages.

Did you check whether multiple instances of \@codemirror/state are installed? Even when your package.json is entirely reasonable, npm will sometimes upgrade an existing install in a way that needlessly duplicates packages.
Azorlogh commented 2021-08-17 15:39:53 +02:00 (Migrated from github.com)

I figured out the issue:
This was caused by the presence of node_modules in the lang-example subdirectory after building.
If I delete node_modules, everything works.
The solution was to add a config option to nodeResolve when building my app with rollup:

nodeResolve({
    dedupe: ["@codemirror/state"]
})

I think this could be a good info to add to the "Bundling with Rollup" article.

I figured out the issue: This was caused by the presence of node_modules in the lang-example subdirectory after building. If I delete node_modules, everything works. The solution was to add a config option to nodeResolve when building my app with rollup: ``` nodeResolve({ dedupe: ["@codemirror/state"] }) ``` I think this could be a good info to add to the "Bundling with Rollup" article.
marijnh commented 2021-08-17 17:49:12 +02:00 (Migrated from github.com)

I think this could be a good info to add to the "Bundling with Rollup" article.

Well, that kind of masks the problem of the duplicated install existing in the first place (running with another bundler or with raw ES modules, you'd still hit the error). The good news is that this seems to happen a lot less with non-0.x versions (because after 1.0, npm will consider all 1.x releases compatible, and thus be less inclined to duplicate them—at least, that was the experience with ProseMirror).

> I think this could be a good info to add to the "Bundling with Rollup" article. Well, that kind of masks the problem of the duplicated install existing in the first place (running with another bundler or with raw ES modules, you'd still hit the error). The good news is that this seems to happen a lot less with non-0.x versions (because after 1.0, npm will consider all 1.x releases compatible, and thus be less inclined to duplicate them—at least, that was the experience with ProseMirror).
Azorlogh commented 2021-08-19 16:27:05 +02:00 (Migrated from github.com)

I see, hopefully it'll get better with 1.0 then 👍

I see, hopefully it'll get better with 1.0 then :+1:
joshmarinacci commented 2021-10-28 01:33:35 +02:00 (Migrated from github.com)

I also just ran into the bug using this template repo and by following the instructions in the Rollup and Writing a Language Package examples. This was with a clean checkout, so I suspect anyone will run into this with the current setup.

I also just ran into the bug using this template repo and by following the instructions in the Rollup and Writing a Language Package examples. This was with a clean checkout, so I suspect anyone will run into this with the current setup.
marijnh commented 2021-10-28 08:09:34 +02:00 (Migrated from github.com)

Running npm install in a clean checkout of this repository gave you duplicated packages? Which npm version is that happening with?

Running `npm install` in a clean checkout of this repository gave you duplicated packages? Which npm version is that happening with?
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
codemirror/lang-example#3
No description provided.