-
-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error: Unrecognized extension value in extension set ([object Object]). This sometimes happens because multiple instances of @codemirror/state are loaded, breaking instanceof checks #480
Comments
npm ls @codemirror/view |
Can you put your code samples on codesandbox.io? I can help you troubleshoot the errors. |
Problem is that I couldn't actually replicate that issue on sandbox or on simple create-react-app example. And I used same react version as in project and checked all package versions. I am a bit confused why it works with Thanks a lot for a quick response @jaywcjlove . |
react-codemirror/extensions/langs/package.json Lines 28 to 42 in 3232f4c
@zeleniucvladislav I have updated the dependencies for |
@jaywcjlove I'm not sure that would fix the problem for me because I want to use only I need same functionality as here basically + applying a custom theme Link to PR mentioned : https://github.com/oslabs-beta/Swell-v13/pull/4 |
is there any solid fix to this, I getting this error randomly. |
Only using |
I updated |
nothing worked for me yet! also the error pops up out of blue. |
@BillC-DEV Hi. Which |
I didn't install |
Clearing your package lock and reinstalling your dependencies often helps with this. |
I have successfully replicated this issue and created a repo with the minimal amount of steps taken to reproduce the error. View the commit history for detailed steps. https://github.com/mbartisan/react-codemirror-issue -- Created a new electron forge application: Installed react and react-dom Installed @uiw/react-codemirror and @codemirror/lang-javascript Then followed the basic usage from the @uiw/react-codemirror readme. import React from 'react';
import CodeMirror from '@uiw/react-codemirror';
import { javascript } from '@codemirror/lang-javascript';
function App() {
const onChange = React.useCallback((value, viewUpdate) => {
console.log('value:', value);
}, []);
return (
<CodeMirror
value="console.log('hello world!');"
height="200px"
extensions={[javascript({ jsx: true })]}
onChange={onChange}
/>
);
}
export default App;
|
My issue was originating from webpack and I was able to adjust my webpack config to resolve it. My fix was to add this to the webpack config: // webpack.config.js
const path = require('path');
module.exports = {
resolve: {
alias: {
'@codemirror/state': path.resolve(__dirname, 'node_modules/@codemirror/state'),
}
}
}; Edit: I continued to have some other various issues (mostly with Extensions) which were fixed by mapping to the entire codemirror dir like below. Not fully tested, so your milage may very as well as introduce side effects. // webpack.config.js
const path = require('path');
module.exports = {
resolve: {
alias: {
'@codemirror': path.resolve(__dirname, 'node_modules/@codemirror/'),
}
}
}; |
Thank you, I solved this problem with clearing lock file and reinstalling. |
React: 18.2.0 I've tried a lot of things to no avail, but this worked for me rm -rf package-lock.json |
Code throw error from here
if I change it to
looks like ok, if I set prop extensions =[] , will not throw this error |
Have this issue when passing
css()
extension for CodeMirror from here : https://www.npmjs.com/package/@codemirror/lang-css. This issue is not happening when downgrading to@uiw/react-codemirror 4.8.1
. I also need@uiw/codemirror-themes
package and it gives sameunrecognized extension value
error when using with an old version. I found this@uiw/codemirror-extensions-langs
package that works fine but it's size is very big and I need only certain things from there. Is there any solution to use@codemirror/lang-*
packages with latest version of@uiw/react-codemirror
?Unfortunately I couldn't replicate that issue in sandbox as an example
@codemirror/state/dist/index.cjs logs
Old version
New version
npm ls @codemirror/state gives same versions
The text was updated successfully, but these errors were encountered: