Annotated dynamic import causes crash
See original GitHub issueWhen using webpack annotations for dynamic imports, madge tries to make sense of the first argument to the import, which will be undefined
.
So:
const Graph = React.lazy(() => import(/* webpackChunkName: 'react-graph-vis' */ `react-graph-vis`))
causes
✖ TypeError: Cannot read property 'lastIndexOf' of undefined
at Object.startsWith (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:2025:20)
at mangleScopedPackageName (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27283:16)
at mangleScopedPackageNameWithTrace (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27270:23)
at loadModuleFromImmediateNodeModulesDirectory (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27195:83)
at /Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27172:39
at Object.forEachAncestorDirectory (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:12577:26)
at loadModuleFromNearestNodeModulesDirectoryWorker (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27166:19)
at loadModuleFromNearestNodeModulesDirectoryTypesScope (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27162:16)
at tryResolve (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27348:28)
at classicNameResolver (/Users/torgeir/dev/signatu/signatu/node_modules/typescript/lib/typescript.js:27324:24)
Issue Analytics
- State:
- Created 4 years ago
- Reactions:13
- Comments:15 (3 by maintainers)
Top Results From Across the Web
Annotated dynamic import should not cause crash package ...
This issue is originated from madge pahen/madge#211 mangeScopedPackageName function crashes when madge is running classicNameResolver ...
Read more >Dynamic Import, Code Splitting, Lazy Loading, and Error ...
This article is a detailed guide on how to use dynamic import, which enables code splitting and lazy loading. It also describes how...
Read more >How to prevent typescript from transpiling dynamic imports ...
Since require() can't import ESM modules, my bot ends up crashing. I tried however to stop my ts compiler, copy the code from...
Read more >When Things Go Wrong — PyInstaller 5.7.0 documentation
Analysis creates a message when it detects an import and the module it names cannot be found. A message may also be produced...
Read more >Fixed issues in Premiere Pro versions 23.x and 22.x
Fixed issues that could cause: All files from Canon cinema cameras to be imported with the clip name CLIPS001. A crash while adjusting...
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
Just change all the dynamic
import(
calls to be static import statements at the top, run madge, git stash the conversion ofimport(
calls (or put it on a branch).Getting the same issue, typescripts
import(...)
gives the above mentioned error