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

Cannot import paths outside of an aliased directory #396

Closed
ashubham opened this issue Jun 15, 2020 · 0 comments · Fixed by #407
Closed

Cannot import paths outside of an aliased directory #396

ashubham opened this issue Jun 15, 2020 · 0 comments · Fixed by #407

Comments

@ashubham
Copy link
Contributor

Describe the bug

Suppose I have an aliased directory with index file:

// alias-dir/index.ts

import { msg } from '../import-from-parent';

export const msg2 = msg + ' from Alias';

I have defined alias as:

alias: {
    '/@alias/': path.resolve(__dirname, './src/alias-dir/')
}

The runtime fails with:
GET http://localhost:3001/import-from-parent net::ERR_ABORTED 404 (Not Found)

This is because aliased dirs are put on the root level while serving, hence breaking their relationship chain.

Reproduction

https://github.com/ashubham/vite-bug-1

System Info

  • required vite version: 0.20.7
  • required Operating System: OSX
  • required Node version: 12.16.0
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant