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

Import assets with alias #146

Closed
ds-pankov opened this issue Jun 21, 2023 · 5 comments
Closed

Import assets with alias #146

ds-pankov opened this issue Jun 21, 2023 · 5 comments
Labels
discussion Discussion

Comments

@ds-pankov
Copy link

ds-pankov commented Jun 21, 2023

Hi, thanks for the good tool.

I can't exclude the import of assets (pictures) with the ts + vite alias. How can you defeat this?

Screenshot 2023-06-21 at 10 18 56

tsconfig:

"paths": {
  "@openquiz/*": ["../../packages/*/src"],
  "@/*": ["./src/*"],
}

vite.config.ts:

resolve: {
  alias: {
    '@': path.resolve(__dirname, './src')
  }
}
@ds-pankov ds-pankov added the discussion Discussion label Jun 21, 2023
@webpro
Copy link
Collaborator

webpro commented Jun 21, 2023

Do you have a repo you can link to? Or reproduction? Or could you add something to the test/fixtures folder in a PR?

@ds-pankov
Copy link
Author

@webpro made a demo repository https://github.com/ds-pankov/issue-demo. Alias is configured in vite.config.ts.

@webpro
Copy link
Collaborator

webpro commented Jun 24, 2023

🚀 This issue has been resolved in v2.14.2. See Release 2.14.2 for release notes.

@webpro webpro closed this as completed in 674b6e2 Jun 24, 2023
@webpro
Copy link
Collaborator

webpro commented Jun 24, 2023

When TypeScript doesn't resolve such a module I'm using a brittle heuristic to decide whether its importing an external dependency or not. When using the @ to prefix paths this is unfortunate. In your case this is fixed now (using a path prefix like @assets/img/* might result in a "missing" external dependency).

@ds-pankov
Copy link
Author

Thanks.

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

No branches or pull requests

2 participants