Solvedfork ts checker webpack plugin Type checking for node_modules
✔️Accepted Answer
For me, the solution was to add skipLibCheck: true
to tsconfig.json
Other Answers:
Thanks so much for sharing that @maksimsemenov - I wonder if it would be worth making skipLibCheck: true
on by default with fork-ts-checker-webpack-plugin
?
Some background; there are 2 compiler flags on by default with ts-loader
:
skipLibCheck: true,
suppressOutputPathCheck: true
If values are supplied for these properties in the tsconfig.json
than the supplied values are the ones that that will be used; otherwise it's skipLibCheck: true
by default (for performance reasons) and suppressOutputPathCheck: true
(because microsoft/TypeScript#7363 ).
For me it would make sense to apply the same defaults to fork-ts-checker-webpack-plugin
; for 2 reasons:
-
If people are using ts-loader alone, and they then move to plug fork-ts-checker-webpack-plugin into their build they may bump on these errors. Let's give people an easy on-ramp
😄 -
These are good defaults for the reasons given.
I'd be totally up for making those changes. @piotr-oles what do you think?
We are matching the relative path, so something like
./node_modules/react-codemirror2
.
You try to match the absolute path against that in your example - that cannot work.Something like
!node_modules
,!/node_modules/
,!**/node_modules/**
could work - you'll have to try that, I never use that feature myself and I don't have a reproduction project for that.
SOLVED
Thank you @phryneas !
so final config:
tsconfig.json
{
...
"exclude": ["dist", "node_modules"]
}
skipLibCheck
is omitted, so its default false
is okay
webpack.config.js
...
new ForkTsCheckerWebpackPlugin({
async: !env.prod,
useTypescriptIncrementalApi: true,
tsconfig: resolve(__dirname, './tsconfig.json'),
checkSyntacticErrors: true,
reportFiles: ['**', '!**/__tests__/**', '!**/?(*.)(spec|test).*'],
silent: true,
}),
...
And it works like charm, thanks a lot for support :)
I'm seeing a whole bunch of errors related to
node_modules
directory, like so:My webpack config:
My
tsconfig.json
:I read through #116, but none of the recipes mentioned there worked for me.
Are there any other config options or any other details that I'm missing?