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

Vue style import will conflict with the base url config if base url is the prefix of project's full path #25

Open
7 tasks done
DanSnow opened this issue Mar 8, 2022 · 3 comments · May be fixed by vitejs/vite#7224
Open
7 tasks done
Labels
bug Something isn't working

Comments

@DanSnow
Copy link

DanSnow commented Mar 8, 2022

Describe the bug

Vue plugin will generate a full path to import style parts in SFC. If we set the base URL to /home/ on Linux, it will fail to import.

Reproduction

https://stackblitz.com/edit/vitejs-vite-7nlqrm?file=vite.config.js&terminal=dev

To reproduce this error, you need to meet these conditions, let's assume that your project is under /home/user/project:

  1. your base URL must be set to part of the full path of your project, e.g. /home/ or /home/user/.
    If you are on Mac, please try /Users/
  2. you must have some style in Vue SFC

System Info

System:
    OS: Linux 5.4 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (4) x64 Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
    Memory: 10.33 GB / 31.26 GB
    Container: Yes
    Shell: 5.8 - /usr/bin/zsh
  Binaries:
    Node: 16.13.1 - ~/.asdf/installs/nodejs/lts/bin/node
    Yarn: 3.1.1 - /usr/bin/yarn
    npm: 8.1.2 - ~/.asdf/installs/nodejs/lts/bin/npm
  Browsers:
    Chrome: 99.0.4844.51
    Firefox: 97.0.2
  npmPackages:
    @vitejs/plugin-vue: ^2.2.4 => 2.2.4
    vite: ^2.7.13 => 2.8.3

Used Package Manager

yarn

Logs

No response

Validations

@poyoho
Copy link
Member

poyoho commented Mar 8, 2022

I use vite template create project

pnpm create vite

and add the config

export default defineConfig({
  base: '/home/',
  plugins: [vue()]
})

I think it same with your repo.

But I can't got a error. 😮

@DanSnow
Copy link
Author

DanSnow commented Mar 8, 2022

@poyoho Thanks for sharing. I try again with pnpm and create-vite and still can reproduce this error. I have updated the description with more details, could you please try again?

@poyoho
Copy link
Member

poyoho commented Mar 8, 2022

wow..amazing

@DanSnow DanSnow changed the title Vue style import will conflict with the base url config if base url is exist on the real filesystem Vue style import will conflict with the base url config if base url is the prefix of project Mar 8, 2022
@DanSnow DanSnow changed the title Vue style import will conflict with the base url config if base url is the prefix of project Vue style import will conflict with the base url config if base url is the prefix of project's full path Mar 8, 2022
@poyoho poyoho linked a pull request Mar 8, 2022 that will close this issue
9 tasks
@haoqunjiang haoqunjiang added bug Something isn't working p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) and removed pending triage labels Nov 16, 2022
@patak-dev patak-dev transferred this issue from vitejs/vite Dec 3, 2022
@edison1105 edison1105 added cannot reproduce bug Something isn't working and removed bug Something isn't working p3-minor-bug 🔨 An edge case that only affects very specific usage (priority) cannot reproduce labels Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants