`no-cycle` breaks when my files import node_module `index.es.js` files from fortawesome
See original GitHub issueThis is a totally wacky one. The files throwing errors below are imported by two of my js files. And for some reason, they’re getting parsed, even though no other files in node_modules are. Of course, I’m in a monorepo, which might confound things a bit:
/@arc // root package
/node_modules // actual modules hoisted to here
/apps
/react-app
/components
/Icon.js // importer
The import statements are nothing special:
import {library} from '@fortawesome/fontawesome-svg-core';
import {faFacebookF} from '@fortawesome/free-brands-svg-icons';
import {faCalendar} from '@fortawesome/free-regular-svg-icons';
import {faBook} from '@fortawesome/free-solid-svg-icons';
import {FontAwesomeIcon} from '@fortawesome/react-fontawesome';
And these are the errors:
Error while parsing /Users/msc/Code/hub/@arc/node_modules/@fortawesome/fontawesome-svg-core/index.es.js
Line undefined, column undefined: Cannot read property 'tokens' of null
`parseForESLint` from parser `/Users/msc/Code/hub/@arc/node_modules/babel-eslint/lib/index.js` is invalid and will just be ignored
Error while parsing /Users/msc/Code/hub/@arc/node_modules/@fortawesome/free-brands-svg-icons/index.es.js
Line undefined, column undefined: Cannot read property 'tokens' of null
`parseForESLint` from parser `/Users/msc/Code/hub/@arc/node_modules/babel-eslint/lib/index.js` is invalid and will just be ignored
Error while parsing /Users/msc/Code/hub/@arc/node_modules/@fortawesome/free-regular-svg-icons/index.es.js
Line undefined, column undefined: Cannot read property 'tokens' of null
`parseForESLint` from parser `/Users/msc/Code/hub/@arc/node_modules/babel-eslint/lib/index.js` is invalid and will just be ignored
Error while parsing /Users/msc/Code/hub/@arc/node_modules/@fortawesome/free-solid-svg-icons/index.es.js
Line undefined, column undefined: Cannot read property 'tokens' of null
`parseForESLint` from parser `/Users/msc/Code/hub/@arc/node_modules/babel-eslint/lib/index.js` is invalid and will just be ignored
Error while parsing /Users/msc/Code/hub/@arc/node_modules/@fortawesome/react-fontawesome/index.es.js
Line undefined, column undefined: Cannot read property 'tokens' of null
`parseForESLint` from parser `/Users/msc/Code/hub/@arc/node_modules/babel-eslint/lib/index.js` is invalid and will just be ignored
The errors go away when I disable no-cycle
. Thanks again for the help!
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (4 by maintainers)
Top Results From Across the Web
`.es.js` should be renamed `.mjs` · Issue #16439 - GitHub
The fix is to rename the files .mjs which officially indicates they are modules, not common-js style exports. Expected behavior. I expect other ......
Read more >Please how can I fix this error in my react app - Stack Overflow
Please post your package.json file so to be able to better determine the cause of the issue.
Read more >import - JavaScript - MDN Web Docs - Mozilla
The static import declaration is used to import read-only live bindings which are exported by another module. The imported bindings are ...
Read more >Documentation - ECMAScript Modules in Node.js - TypeScript
When a .ts file is compiled as an ES module, ECMAScript import / export syntax is left alone in the .js output; when...
Read more >ECMAScript modules | Node.js v19.3.0 Documentation
Mandatory file extensions#. A file extension must be provided when using the import keyword to resolve relative or absolute specifiers. Directory indexes (e.g. ......
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 FreeTop 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
Top GitHub Comments
Thanks @ljharb
node’s official docs for .js vs .mjs, but no, there’s no official doc for “js files should always be transpiled on prepublish into CJS”, that’s just the overwhelming community convention for a decade.