question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

alias for `/@/` not work properly

See original GitHub issue

Describe the bug

Alias for /@/ not working properly. It works in v1.

Reproduction

https://github.com/foisonocean/vite2-alias-bug

System Info

  • required vite version: 2.0.0-beta.5
  • required Operating System: Linux
  • required Node version: v15.5.0
  • Optional:
    • yarn version: 1.22.10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
yyx990803commented, Jan 5, 2021

这个 issue 跟其他的 alias 问题没有任何关系,只是 alias 不作用于 HTML 里的 url 而已。

2.0 的 alias 是直接替换,所以如果你用了 /@/ 这样的 alias 那么值也需要有 / 结尾。https://vitejs.dev/guide/migration.html#alias-behavior-change

3reactions
hronrocommented, Jan 6, 2021

/@/ still not work in vite@2.0.0-beta.9, it seems like a upstream bug from @rollup/plugin-alias (https://github.com/rollup/plugins/issues/759).

{
  alias: {
    // not work
    '/@/': path.resolve(__dirname, 'foo') + '/',
    // works
    '/@': path.resolve(__dirname, 'foo'),
  },
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

'alias' does not work correctly - Apple Community
I had an 'alias' to a folder on my desktop which no longer went to the aliased folder, but instead, opened a folder...
Read more >
Outlook alias not resolving properly (i.e., - Microsoft Community
I have an Office 365 subscription that I am using a local copy of Outlook 2016 with. I login to my Microsoft account...
Read more >
Variable in Bash Alias not working as intended [duplicate]
The alias doesn't work properly until running source ~/.bashrc or source ~/.bash_aliases ONLY AFTER running the alias once first.
Read more >
Aliases in .bash_profile not working properly - Stack Overflow
I fixed this by editing my .bash_profile in vim or nano something about text edited messed it up unsure why. I tried to...
Read more >
why alias names defined in .bashrc file are not working?
This may happen because your PATH has not been set correctly to use all alias referenced binaries' absoulte path.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found