The exported identifier "CodeMirror" is not declared in Babel's scope tracker
as a JavaScript value binding, and "@babel/plugin-transform-typescript"
never encountered it as a TypeScript type declaration.
It will be treated as a JavaScript value.
This problem is likely caused by another plugin injecting
"CodeMirror" without registering it in the scope tracker. If you are the author
of that plugin, please use "scope.registerDeclaration(declarationPath)".
Getting this error while trying to import codemirror package to ember Ember version: 3.28.10 codemirror: 5.65.13
Made following entries in ember-cli-build.js
app.import('node_modules/codemirror/lib/codemirror.css');
app.import('node_modules/codemirror/mode/javascript/javascript.js');
app.import('node_modules/codemirror/mode/django/django.js');
app.import('node_modules/codemirror/mode/css/css.js');
app.import('node_modules/codemirror/mode/sass/sass.js');
app.import('node_modules/codemirror/mode/markdown/markdown.js');
app.import('node_modules/codemirror/mode/meta.js');
app.import('node_modules/codemirror/addon/edit/matchtags.js');
app.import('node_modules/codemirror/addon/fold/foldcode.js');
app.import('node_modules/codemirror/addon/fold/foldgutter.js');
app.import('node_modules/codemirror/addon/fold/xml-fold.js');
app.import('node_modules/codemirror/addon/fold/brace-fold.js');
In webpack.config.common.js
optimization: {
runtimeChunk: {
name: 'manifest'
},
splitChunks: {
minSize: 0,
chunks: 'all',
cacheGroups: {
codemirror: {
test: /[\\/]node_modules[\\/](codemirror)[\\/]/,
name: 'codemirror',
idHint: 'codemirror',
chunks: 'all',
filename: `assets/codemirror${env === 'prod' ? '.[chunkhash]' : ''}.js`,
},
},
},
},
importing the code inside the component as
let CodeMirror = await import(‘codemirror’);
Embroider and typescript is enabled in the code base