-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Importing sometimes imports relative path instead of absolute when using project references #32144
Comments
Hey @Tyriar, can you see if this is fixed for you now? There have been some changes around picking module specifiers in the last couple versions, and I can’t repro this in 3.6 or 3.7. |
This does seem to be fixed when using TS 3.7.2, thanks! |
@andrewbranch there is still an issue where implementing an interface puts these ugly inline imports that are relative: Is this known? |
@bpasero I’ve fixed a similar issue to that before so I know exactly why that’s happening, but unfortunately each of these needs to be addressed in its own separate codefix/refactor. Would you mind opening a new bug and mentioning me? |
@andrewbranch this still seems to happen when importing from the same project: Notice TS version in bottom and proposed auto import. Expected is: import { blend } from 'browser/Color'; |
I have also noticed important from an adjacent file importing |
@Tyriar I think the Color example is expected behavior, depending on your typescript-language-features settings: “Auto” will still prefer relative imports if they’re shorter than the non-relative alternative. If you always want the non-relative path, you can adjust this setting accordingly.
This sounds like a different (and worse) issue. Do you have repro steps for this one? If so, do you mind opening a new issue? |
@andrewbranch thanks seem to work. I'll add that setting to workspace settings and ping back if there are further issues.
Repro:
This is happening because of |
Fixes some auto imports in VS Code, see microsoft/TypeScript#32144
|
I could probably just move over to use non-relative everywhere, probably based out of the |
I’m honestly not sure what the best setup for that is. I think what your asking for is super common in Webpack, but it seems like |
@andrewbranch the setup for the addons is admittedly a little weird, TS is referenced from the core and included in the addon bundles. Typically these just reference .d.ts files but they can also include .ts files that result in additional output. The reason for this approach is that we wanted to do a renderer but not include it in the main binary as it's a lot of code to load when it's not being used, and we don't want to expose a bunch of API just for this "internal" project. |
TypeScript Version: 3.5.2
Code
Auto importing
CellData
in https://github.com/xtermjs/xterm.js/blob/73521390d29c8a111058a6a7d08edd827ba498b7/src/browser/ColorManager.ts will import from../../out/common
instead ofcommon/
See tsconfigs:
ColorManager
lives in https://github.com/xtermjs/xterm.js/blob/73521390d29c8a111058a6a7d08edd827ba498b7/src/browser/tsconfig.jsonCellData
lives in https://github.com/xtermjs/xterm.js/blob/73521390d29c8a111058a6a7d08edd827ba498b7/src/common/tsconfig.jsonExpected behavior:
Actual behavior:
The text was updated successfully, but these errors were encountered: