-
Notifications
You must be signed in to change notification settings - Fork 32
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
[Feature]: Support for DTS paths replacement #409
Comments
Sub task of #140 |
现在 0.1.5 版本解决了值导入的别名问题,还差类型导入的别名问题没实现,加油 |
Any update on this? |
Not yet, you can use tsc-alias to replace alias paths with relative paths after Rslib compilation. |
But when I try to use the |
This is usually due to {
"compilerOptions": {
"baseUrl": ".",
"rootDir": "src",
},
"include": ["src"]
} Open another issue and provide reproduction demo if you have further questions. |
@Timeless0911 is this something that is open for contribution? I have an POC plugin using |
Yeah, PR is welcome for this feature which should be a config named TBH, I wanna to implement this feature by someway using AST formly. And I think you can implement this feature in a simple way first, and then we can iterate on it gradually day by day. |
Ok great, I'll take a look. Agreed on AST implementation. Is there a recommended place to start looking into that? I hit some issues with a similar contribution to There are definitely some edge cases with simple regular expressions like having I'll make sure to handle the same cases I covered for the vite plugin, but AST as well as some extra resolution might be required. |
FWIW, es-module-lexer and cjs-modules-lexer are way cheaper and accurate to find the importing statements comparing to regex and AST parsing. |
@lachieh Hi, we need to put this feature on the agenda this quarter. I think we can first implement a simple version to ensure the availability of basic scenes, and then gradually iterate and optimize it. Are you interested in contributing a PR to implement it and then we can complete this feature together? |
Thanks for the ping! Apologies for not getting to it, I should be able to look at it early next week if that works? I like the look of the lexer packages, does an implementation using those sound like a good first iteration? |
It suddenly occurred to me, is it possible to achieve this through a TypeScript plugin. I'm not sure if it's possible to change the d.ts output by a TS plugin, but if it's possible, we can add the internal TS plugin as we're using TS API now. |
I think both TypeScript plugin and lexer are good for me to implement the first iteration. |
What problem does this feature solve?
The
compilerOptions#paths
in tsconfig.json should work for DTS output.Modern.js Module supports this, see https://github.com/web-infra-dev/modern.js/blob/main/packages/solutions/module-tools/src/utils/dts.ts#L116
What does the proposed API look like?
This should work out of the box.
The text was updated successfully, but these errors were encountered: