Skip to content
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

Allow missing baseUrl for TS 4.1+ #143

Closed
jakebailey opened this issue Sep 19, 2020 · 4 comments · Fixed by #208
Closed

Allow missing baseUrl for TS 4.1+ #143

jakebailey opened this issue Sep 19, 2020 · 4 comments · Fixed by #208

Comments

@jakebailey
Copy link

jakebailey commented Sep 19, 2020

TypeScript 4.1+ support paths without baseUrl. See:

Effectively, the paths become relative to the tsconfig.json file.

I'm testing a project with the new beta and baseUrl removed to get better auto-completion, but it appears this library (which is used by tsconfig-paths-webpack-plugin) requires baseUrl to be specified. I've even tried in the plugin to override baseUrl with . (which is pretty much what TS does), but since the plugin loads the config using this library and this library throws an error, the plugin doesn't get to the point where it could override the config.

Perhaps if the config has no baseUrl, it could be treated as a baseUrl of '.'? Or, change the result to allow undefined locations (and update the plugin)?

2022 EDIT: since it's been a long time and this hasn't been fixed, I had written my own little function to do everything needed for path mapping: https://github.com/microsoft/pyright/blob/169c6089b9914870c43622743c75844657cd9d70/build/lib/webpack.js#L90

@jakebailey
Copy link
Author

TS 4.1 has been released, with the implicit baseUrl. I've worked around it for now by using a second duplicate config file with baseUrl set.

appsemble-bot pushed a commit to appsemble/appsemble that referenced this issue Feb 16, 2021
This means the aliases related to resolving Appsemble dependencies in
out Webpack configurations can be removed.

Unfortunately the `baseUrl` property needs to be set in `tsconfig.json`
to support this due to
dividab/tsconfig-paths#143.
@aleclarson
Copy link
Contributor

If anyone stumbles on this and wants to help, please provide a minimal reproduction of tsconfig-paths failing when baseUrl is undefined. Thanks!

@marvinroger
Copy link

Hi @aleclarson, thanks for taking a look at this issue.

There you go: https://github.com/marvinroger/tsconfig-paths-baseurl-reproduction

@aleclarson
Copy link
Contributor

@marvinroger #208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants