[Dependency] "node_modules\\minimatch\\dist\\cjs\\index" has no exported member named `IMinimatch`. Did you mean 'Minimatch'?
Describe the bug
Compilation error (To see more details, there is a screenshot below):
ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts
29:41-49
[tsl] ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts(29,42)
TS2694: Namespace '"P:\\dev\\nota\\node_modules\\minimatch\\dist\\cjs\\index"' has no exported member 'IOptions'.
ts-loader-default_e3b0c44298fc1c14
ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts
74:29-39
[tsl] ERROR in P:\dev\nota\node_modules\@types\glob\index.d.ts(74,30)
TS2724: '"P:\\dev\\nota\\node_modules\\minimatch\\dist\\cjs\\index"' has no exported member named 'IMinimatch'. Did you mean 'Minimatch'?
ts-loader-default_e3b0c44298fc1c14
To Reproduce
- In the
dev-editorbranch, immediately after the PR from thedev(Commit ID: 251fb37cf35207a61c47e46fcab022e1ce8b092a), the above compilation error shows up.
Additional Context
- After browsing some solutions on the internet, I found out the following resources are useful to understand the weird behaviour behind it.
- This StackOverflow answer do solve my problem by doing the following in
package.json:
"overrides": {
"minimatch": "5.1.2",
"glob": "8.1.0"
}
- This is also a potential correct understanding of the problem (BendingBender's reply): https://github.com/DefinitelyTyped/DefinitelyTyped/discussions/63967
- I believe the
globteam themselves have already been aware of the issue since last year, they did update to the correct version. 4.1 But since this valuable error is still somehow able to trigger (like in our case), I believe there is a deep hard-to-discover weird dependency-dependency version issue under ourpackage-lock.jsonthat triggers this error without being detected bynpm. 4.2 I tried to iterate every dependency that depends onglobandminimatchand fix their version. I couldn't really find it. So I choose to simply override theminimatchversion to5.1.2and solves the problem. 4.3globteam related issues:- https://github.com/isaacs/node-glob/issues/490
- https://github.com/isaacs/node-glob/pull/489
Screenshots
The issue should be fixed under dev-editor since it only triggers after merging to dev-editor. But I am going to fix this under dev branch since I am currently doing a merge from dev to dev-editor anyway.
Cannot simply override every minimatch or glob to a specific version. I need to find the source of the bug first.
The issue still happens in the dev-editor branch. F myself.
The author of rimraf, glob, and minimatch replied:
Upgrade rimraf, glob, and minimatch to latest. Remove the @types packages for all three. Then it'll work fine. These three are all written in ts now, the @types packages are causing the problem. Source: I wrote all three of these.
My plan is to introduce a new script named postinstall.js which will delete node_modules/@types/glob manually after npm install.
Ref: https://stackoverflow.com/questions/75890950/node-modules-minimatch-dist-cjs-index-has-no-exported-member-ioptions#comment137653603_75950982