Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not compatible with non-flattened (pnpm) node_modules #164

Closed
IlyaSemenov opened this issue Oct 6, 2018 · 5 comments
Closed

Not compatible with non-flattened (pnpm) node_modules #164

IlyaSemenov opened this issue Oct 6, 2018 · 5 comments
Labels

Comments

@IlyaSemenov
Copy link

IlyaSemenov commented Oct 6, 2018

If a project uses non-flattened node_modules (such as created by pnpm), fork-ts-checker-webpack-plugin fails to load typings of nested dependencies.

Steps to reproduce

Clone https://github.com/IlyaSemenov/fork-ts-checker-webpack-plugin-pnpm-reproduction, then:

npm install
npx webpack

Make sure the compilation succeeds, then:

rm -rf node_modules
npm i -g pnpm
pnpm install
npx webpack

The type checks will fail.

Actual result

❯ npx webpack
Starting type checking service...
Using 1 worker with 2048MB memory limit
Hash: 34452b84502b638c21f7
Version: webpack 4.20.2
Time: 2868ms
Built at: 10/06/2018 5:00:49 PM
  Asset      Size  Chunks             Chunk Names
main.js  3.76 KiB    main  [emitted]  main
Entrypoint main = main.js
[./app.js] 21 bytes {main} [built]

ERROR in /Users/semenov/tmp/fts/node_modules/.registry.npmjs.org/@types/koa/2.0.46/node_modules/@types/cookies/index.d.ts
ERROR in /Users/semenov/tmp/fts/node_modules/.registry.npmjs.org/@types/koa/2.0.46/node_modules/@types/cookies/index.d.ts(12,26):
TS2307: Cannot find module 'express'.

ERROR in /Users/semenov/tmp/fts/node_modules/.registry.npmjs.org/@types/koa/2.0.46/node_modules/@types/cookies/index.d.ts
ERROR in /Users/semenov/tmp/fts/node_modules/.registry.npmjs.org/@types/koa/2.0.46/node_modules/@types/cookies/index.d.ts(13,26):
TS2307: Cannot find module 'connect'.

ERROR in /Users/semenov/tmp/fts/node_modules/fork-ts-checker-webpack-plugin/lib/types/index.d.ts
ERROR in /Users/semenov/tmp/fts/node_modules/fork-ts-checker-webpack-plugin/lib/types/index.d.ts(3,23):
TS2307: Cannot find module 'chalk'.

ERROR in /Users/semenov/tmp/fts/node_modules/fork-ts-checker-webpack-plugin/lib/types/NormalizedMessage.d.ts
ERROR in /Users/semenov/tmp/fts/node_modules/fork-ts-checker-webpack-plugin/lib/types/NormalizedMessage.d.ts(2,30):
TS2307: Cannot find module 'tslint'.

Expected result

  1. Type checks within non-flattened node_modules work fine (same as they do with tsc, ts-node, tslint etc.)
  2. Honestly, I would expect fork-ts-checker-webpack-plugin not to descend into each and every module in node_modules until it's used by webpack compilation. However there are probably reasons for it to do that? Like reading all global augmentations?
@IlyaSemenov
Copy link
Author

UPDATE: while checking the instructions above, I noticed that the last error (Cannot find module 'tslint') shows even with npm.

@johnnyreilly
Copy link
Member

Is the problem related to symbolic links?

I know we had to make changes to ts-loader to support this: TypeStrong/ts-loader#774

Perhaps similar need to be applied to this plugin?

@IlyaSemenov
Copy link
Author

Honestly I have not a slightest clue what could be the reason. 🤷‍♂️ I never examined how this library worked.

@johnnyreilly
Copy link
Member

Now's your chance 😉

@stale
Copy link

stale bot commented May 20, 2019

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label May 20, 2019
@stale stale bot closed this as completed Jun 3, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants