My project builds fine using ts-loader 2.2.0 with Webpack 2.4.1 and Typescript 2.3.4.
If I change to Typescript 2.4.1 however, it's a complete bust. It seems completely unable to resolve modules from the node_modules directory. Is there some secret sauce I'm missing?
(fwiw I was originally using ts-loader 2.0.3, but upgraded to 2.2.0 when I encountered this issue. When reverting back to ts 2.3.4 I left the ts-loader at 2.2.0 and it seemed to still be ok.)
Thanks.
ERROR in D:\dev\pseudoqurl\src\lib\contentHasher.ts
(31,25): error TS2307: Cannot find module 'crypto'.
ERROR in D:\dev\pseudoqurl\src\lib\contentHasher.ts
(32,53): error TS2307: Cannot find module 'fs'.
ERROR in D:\dev\pseudoqurl\src\lib\contentHasher.ts
(48,8): error TS2304: Cannot find name 'Buffer'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'jsonwebtoken'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'keygrip'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'koa'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'koa-bodyparser'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'koa-compose'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'koa-passport'.
ERROR in D:\dev\pseudoqurl\src\capuchin\tsconfig.json
error TS2688: Cannot find type definition file for 'koa-router'.
... and so on and so on.
Seeing the same issue after upgrading to TypeScript 2.4.1 (on both ts-loader 2.0.2. and 2.2.0 same as @stephensong).
This is likely connected to https://github.com/Microsoft/TypeScript/issues/16772
Yup - looks to be a problem with TypeScript 2.4.1 as described by @oliverguenther. It might be the case that we need to make a change to support these changes which are due to land with TypeScript 2.5. Hopefully we can use the same approach as in ts-node:
https://github.com/TypeStrong/ts-node/pull/366
Will leave this open as a reminder for now.
I have the same issue,
Downgrading to TypeScript 2.4.0 solved my problem. But, indeed, that's a problem with @types.
I think the remedy for this is pretty simple - see the link back to the ts-node PR for details. I'll take a look at this as soon as I can. I always say this and it bears repeating: PRs are always welcome!
Okay - the fix is actually super simple and seems to work. I'll look to merge this in and release a new version of ts-loader as soon as I can.
I can verify that this is fixed with a local npm linked version of ts-loader with your fix applied to it. I'm still seeing a number of new issues, but these all appear to be by design due to the stricter checks in 2.4.
Many thanks @johnnyreilly , not only for this fix but for your continued efforts.
Great - thanks for testing @oliverguenther! I really appreciate that. 馃尫
2.2.1 has shipped!
Most helpful comment
I can verify that this is fixed with a local
npm linked version of ts-loader with your fix applied to it. I'm still seeing a number of new issues, but these all appear to be by design due to the stricter checks in 2.4.Many thanks @johnnyreilly , not only for this fix but for your continued efforts.