Skip to content

Enable baseUrl replacer only when baseUrl option is set in tsconfig.json #169

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

Closed
Jokero opened this issue Mar 24, 2023 · 1 comment · Fixed by #170
Closed

Enable baseUrl replacer only when baseUrl option is set in tsconfig.json #169

Jokero opened this issue Mar 24, 2023 · 1 comment · Fixed by #170

Comments

@Jokero
Copy link
Contributor

Jokero commented Mar 24, 2023

Currently, baseUrl replacer is always enabled, although baseUrl is an optional field, even when paths option is specified (microsoft/TypeScript#31869).

This causes a bug in a situation when baseUrl option is not set and project module has the same name as a module from node_modules (demo).

It happens because tsc-alias uses ./ as default value for baseUrl when it's not set (https://github.com/justkey007/tsc-alias/blob/v1.8.4/src/helpers/config.ts#L42) and runs baseUrl replacer.

The solution is to not run baseUrl replacer when tsconfig.json doesn't have the corresponding option.

@Jokero
Copy link
Contributor Author

Jokero commented Mar 28, 2023

@justkey007 Can you please publish a new version?

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.

1 participant