Custom tsconfig.json does not work with ForkTsCheckerWebpackPlugin
rkgrep opened this issue · comments
Roman Kinyakin commented
Describe the bug
Providing custom tsconfig.json
file in configFile
parameter for loaders does affect configuration of ForkTsCheckerWebpackPlugin
Path to file is hardcoded on this line
To Reproduce
- Rename
tsconfig.json
totsconfig.nuxt.json
- Add
configFile
parameter to loader configuration (see additional context for example) - Run
nuxt build
Expected behavior
Everything should work fine.
Additional context
Sample config:
loaders: {
ts: {
configFile: 'tsconfig.nuxt.json',
},
tsx: {
configFile: 'tsconfig.nuxt.json',
},
},
Console log:
FATAL Cannot find the "/home/rkgrep/Code/nuxt-project/tsconfig.json" file. 10:45:53
Please check webpack and ForkTsCheckerWebpackPlugin configuration.
Possible errors:
- wrong `context` directory in webpack configuration (if `configFile` is not set or is a relative path in the fork plugin configuration)
- wrong `typescript.configFile` path in the plugin configuration (should be a relative or absolute path)
Please check webpack and ForkTsCheckerWebpackPlugin configuration.
Rafał Chłodnicki commented
You'd also need to override typeCheck
option. Something like:
typescript: {
loaders: {
ts: {
configFile: 'tsconfig.nuxt.json',
},
tsx: {
configFile: 'tsconfig.nuxt.json',
},
},
typeCheck: {
typescript: {
configFile: 'tsconfig.nuxt.json'
}
}
}
But note that you might have to resolve and provide full path to the file.