-
Notifications
You must be signed in to change notification settings - Fork 51
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
Support TypeScript 4.1 #59
Comments
See also: dividab/tsconfig-paths#143, #32 (comment) |
Since 4.1, I've worked around this with secondary configs that extend and add a baseUrl; after hitting more bugs like #60, I've found that it's easier to drop the plugin in favor of a little code that transforms the paths config into webpack resolve aliases; the output is identical to the tsconfig-paths plugin (when it's working). |
Hi, share please your solution / example repo? |
Sure, the function I wrote to generate aliases is here: https://github.com/microsoft/pyright/blob/169c6089b9914870c43622743c75844657cd9d70/build/lib/webpack.js#L90
As far as I can tell, this is all you need to support tsconfig paths. It verifies enough to make the file |
resolve: {
extensions: ['.ts', '.js'],
alias: tsconfigResolveAliases('tsconfig.json'),
}, That is enough? |
Correct. |
With storybook it is correct usage? webpackFinal: async (config) => {
// resolve problem with typescript aliases
config.resolve.alias = {
...config.resolve?.alias,
...tsconfigResolveAliases('../tsconfig.json'),
};
....
} |
I have no idea what storybook is, but I don't see why not. Can't hurt to try. |
I have that config {
"extends": "./tsconfig/nextjs.json",
"include": ["."],
"exclude": ["dist", "build", "node_modules"]
} With |
Last I looked, |
TypeScript 4.1 adds an option to use path mapping without specifying
baseUrl
, more about it in TypeScript 4.1 Release NotesMy project is using TypeScript 4.1.2, trying to remove the
baseUrl
I get the following errorWould like to submit a PR with a little help :)
The text was updated successfully, but these errors were encountered: