ES6 compatibility
See original GitHub issueI’m trying to use react-codemirror
in my ES6 project but it fails.
Importing it that way:
import CodeMirror from 'react-codemirror';
Getting the following error:
[0] ./~/react-codemirror/src/codemirror.js
[0] Module parse failed: app/node_modules/react-codemirror/src/codemirror.js Unexpected token (76:3)
[0] You may need an appropriate loader to handle this file type.
[0] SyntaxError: Unexpected token (76:3)
...
[0] @ ./~/react-codemirror/lib/Codemirror.js 20:42-63
Am I doing something wrong or is the project not compatible yet?
Issue Analytics
- State:
- Created 7 years ago
- Comments:6
Top Results From Across the Web
"es6" | Can I use... Support tables for HTML5, CSS3, etc
As ES6 refers to a huge specification and browsers have various levels of support, "Supported" means at least 95% of the spec is...
Read more >ECMAScript 6 compatibility table
Feature name▻ Current browser 98% ES6 Trans‑ piler 25% Trace...
Optimisation Optimisation Optimisation Optimi...
§proper tail calls (tail call optimisation)▻ 0/2 0/2 0/2
§direct recursionc No...
Read more >JavaScript Versions - W3Schools
ECMAScript versions have been abbreviated to ES1, ES2, ES3, ES5, and ES6. ... Internet Explorer 9 does not support ECMAScript 5 "use strict"....
Read more >Browser Compatibility Testing of JAVASCRIPT with ES6 classes
BROWSER SUPPORT FOR JAVASCRIPT ES6 classes · Google Chrome · Mozilla Firefox · Internet Explorer · Safari · Microsoft Edge · Opera.
Read more >Why You Should Use ES6 - ITNEXT
It is called a “compiler” because it converts ES6 code to ES5 code so that as long as your browser can support ES5,...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I encounter a similar error
I found the problem caused by webpack loading setting, in below line https://github.com/JedWatson/react-codemirror/blob/master/src/Codemirror.js#L17
it is expected to load ‘codemirror’ in ‘node_module’
But if we have webpack like below, which treat ‘src’ as module folder too, then ‘https://github.com/JedWatson/react-codemirror/blob/master/src/Codemirror.js’ itself might be load and cause the error
Remove above resolve setting can solve the problem, but can we change the src file name(Codemirror.js) to avoid conflict with the ‘codemirror’ module for safety
You can change webpack config rather than rename a file https://github.com/JedWatson/react-codemirror/issues/39#issuecomment-220799966