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

fix: add fallback for resolving url #7223

Closed
wants to merge 2 commits into from
Closed

Conversation

Bigfish8
Copy link
Contributor

@Bigfish8 Bigfish8 commented Mar 8, 2022

Description

fix vitejs/vite-plugin-vue#25

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines.
  • Read the Pull Request Guidelines and follow the Commit Convention.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes vitejs/vite#123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

@bluwy
Copy link
Member

bluwy commented Mar 8, 2022

Looks like there's another fix for the same issue at #7224. cc @poyoho

@poyoho
Copy link
Member

poyoho commented Mar 8, 2022

It can't resolve this issues.

If set the base URL to root on Linux and use vue plugin, vue plugin will import css by absolute path. And vite will replace base to /, and absolute path startWith base path will got a error.

the plugin only worker in the .js/.ts and no worker in the .vue

@poyoho
Copy link
Member

poyoho commented Mar 8, 2022

you can config this in the error repo package.json

{
  "pnpm": {
    "overrides": {
      "vite": "/path/vite/packages/vite",
      "@vitejs/plugin-vue": "/path/vite/packages/plugin-vue"
    }
  }
}

and then you can run your vite dist in the error repo

@Bigfish8
Copy link
Contributor Author

Bigfish8 commented Mar 8, 2022

you can config this in the error repo package.json

{
  "pnpm": {
    "overrides": {
      "vite": "/path/vite/packages/vite",
      "@vitejs/plugin-vue": "/path/vite/packages/plugin-vue"
    }
  }
}

and then you can run your vite dist in the error repo

It can't resolve this issues.

If set the base URL to root on Linux and use vue plugin, vue plugin will import css by absolute path. And vite will replace base to /, and absolute path startWith base path will got a error.

the plugin only worker in the .js/.ts and no worker in the .vue

IMO vue-plugin will tranform .vue into .js and work well.
But I do not take my computer home.I will verify it again tomorrow.

@poyoho
Copy link
Member

poyoho commented Mar 9, 2022

I use your code will run error. You try try.

@Bigfish8
Copy link
Contributor Author

Bigfish8 commented Mar 10, 2022

Indeed

I use your code will run error. You try try.

You are right. I mistaken something.
I read the error stack in the situation again.I don not understand there exists two url replace call. one
and another.
Maybe we should delete the second call?
After I delete it, the test case run still run success.

@poyoho
Copy link
Member

poyoho commented Mar 10, 2022

I try use your provide one to resolve.

#7224

@poyoho
Copy link
Member

poyoho commented Mar 10, 2022

middleware will replace request url.

plugin will replace file content.

@Bigfish8 Bigfish8 closed this Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

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