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

File paths correct for barrel file imports, but not changed for 'nested' path imports (after build) #154

Closed
Carnageous opened this issue Aug 21, 2024 · 2 comments
Labels
mistaken This doesn't seem right

Comments

@Carnageous
Copy link

Carnageous commented Aug 21, 2024

Hey! We've been using this plugin happily for quite some time and never had any issues, so first of all thanks a lot!

Now, we are migrating away from using barrel files for imports, so converting things like
import type { Foo } from "$types" to
import type { Foo } from "$types/someStuff".

Now, in the IDE that works well and paths are resolved correctly, but after building in library mode and emitting .d.ts files with vite-plugin-dts, some paths are not resolved at all. As shown in this reproduction repo on stackblitz, importing from a barrel file (that just re-exports) works, but importing directly does not - the path alias is not changed.

So

import type { Foo } from "$types"
// becomes
import type { Foo } from "../types";

but

import type { Foo } from "$types"
// stays the same
import type { Foo } from '$types/someStuff';

The reproduction builds a react library in rollup lib mode, but it's the same for non-react apps, I tested.

Now, I am a bit unsure if this is an issue of this plugin, vite-plugin-dts or just my config, but after some research I think I'm at the right place here.

Please let me know if you need more details!

@Carnageous
Copy link
Author

I don't think (hope) this is related to #101, as there is no leading / in this case, it's just nested folders, and that is supposed to work, right?

@aleclarson aleclarson added the mistaken This doesn't seem right label Nov 5, 2024
@aleclarson
Copy link
Owner

This plugin has no knowledge of .d.ts generation, so my bet is it's an issue with vite-plugin-dts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
mistaken This doesn't seem right
Projects
None yet
Development

No branches or pull requests

2 participants