Skip to content

fix: avoid wrong warning of explicit public paths#4927

Merged
patak-cat merged 1 commit into
vitejs:mainfrom
meteorlxy:meteorlxy/dev
Sep 14, 2021
Merged

fix: avoid wrong warning of explicit public paths#4927
patak-cat merged 1 commit into
vitejs:mainfrom
meteorlxy:meteorlxy/dev

Conversation

@meteorlxy
Copy link
Copy Markdown
Contributor

Description

This issue is caused by #4631, reported here https://github.com/vitejs/vite/pull/4631/files#r707910410.

We should not simply determine publicPath by slicing the string, because the custom public dir can be outside the root dir.

It's OK to use startsWith to check if publicDir is inside root or not, because they are all resolved as absoluted path. An alternative way is to use path.relative().

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 #123).
  • Ideally, include relevant tests that fail without this PR but pass with it.

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.

3 participants