-
-
Notifications
You must be signed in to change notification settings - Fork 246
tsconfig paths resolution not working in v.1.1.0 #258
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
Comments
Is it resolved if you add https://www.npmjs.com/package/tsconfig-paths-webpack-plugin to your setup? https://github.com/TypeStrong/ts-loader#baseurl--paths-module-resolution |
Tried the plugin. It didn't work. I believe this is a regression. Given the nature of the issue is paths resolution, that's definitely something we want to get right for both PnP and not 😁 Anyone bumping on this should pin to 1.0.4 for now. Apologies for the disruption. If @arcanis gets a chance to look at this then hopefully we can get a fix in. Otherwise I'll look at potentially reverting the changes for 1.1.0 for now, and adding a test for paths resolution so we don't break this in future. |
Oh no! Will take a look today, thanks for the repro repo! |
Thanks @arcanis! I really appreciate it ❤️ |
To be sure: even in 1.0.4 the plugin is meant to be required, right? I tried downgrading on the repro repo with the same error. |
Interesting. I didn't try downgrading to 1.0.4 - just adding in https://www.npmjs.com/package/tsconfig-paths-webpack-plugin - thinking that was the issue. I just tried downgrading to 1.0.4 and the same error presents. My {
"name": "fork-ts-checker-webpack-plugin-paths-bug",
"scripts": {
"start": "webpack"
},
"devDependencies": {
"fork-ts-checker-webpack-plugin": "1.0.4",
"ts-loader": "^5.3.3",
"tsconfig-paths-webpack-plugin": "^3.2.0",
"typescript": "^3.4.4",
"webpack": "^4.30.0",
"webpack-cli": "^3.3.0"
}
} My var ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin')
const TsconfigPathsPlugin = require('tsconfig-paths-webpack-plugin');
var webpackConfig = {
mode: 'none',
context: __dirname, // to automatically find tsconfig.json
entry: './src/index.ts',
resolve: {
extensions: ['.ts']
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'ts-loader',
options: {
// disable type checker - we will use it in fork plugin
transpileOnly: true
}
}
]
},
resolve: {
plugins: [new TsconfigPathsPlugin({ /*configFile: "./path/to/tsconfig.json" */ })]
},
plugins: [
new ForkTsCheckerWebpackPlugin({
// Neither of the following solves the issue:
// tsconfig: './tsconfig.json'
// tsconfig: require('path').join(__dirname, './tsconfig.json')
})
]
}
module.exports = webpackConfig Given there's 2 thumbs up for this issue I think we are likely to have a regression. @kaykayehnn it looks like your repro repo might be problematic - can you take a look please? Ideally it should work with 1.0.4 and break with 1.1.0. That isn't the case right now. |
It seems like there's a design flaw in the TS The documentation seems to directly pass the options used for Still hoping to find a workaround, just wanted to share some context 🙂 |
That's really helpful! The output of this could be us opening an issue with the TypeScript repo and seeing if it's possible that could change. Fingers crossed that isn't necessary but it's worth trying. They are helpful and wonderful people 😁 |
Yup! In the meantime I opened #260 with a fix. To people affected by this bug, you can workaround it right now by disabling the incremental API:
|
Sorry about the repo, I hadn't added |
Current behavior
Path aliases specified in tsconfig are not resolved, resulting in resolution errors.
Expected behavior
TS path aliases are resolved as in previous versions. The issue is not present in v1.0.4
Issue reproduction repository
https://github.com/kaykayehnn/fork-ts-checker-webpack-plugin-paths-bug
Steps to reproduce the issue
Environment
The text was updated successfully, but these errors were encountered: