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: warn for unresolved css in html #7911

Merged
merged 7 commits into from May 4, 2022

Conversation

poyoho
Copy link
Member

@poyoho poyoho commented Apr 26, 2022

Description

fix: #7160

Additional context

catch unresolved css url in html.


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.

Comment on lines +342 to +346
styleUrls.push({
url,
start: node.loc.start.offset,
end: node.loc.end.offset
})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still unsure about the order change in the JS that this is going to produce. IIUC, before if the user had first the CSS styles, these were the first imports in the JS, and now they will be imported at the end after all other JS tags. I wonder if we should mark the JS position by adding something like

  js += `${STYLE_IMPORT_MARKER_}${styleUrlId}`

And then we can replace it by \nimport ... or by `` depending on the result of the URL resolution.

poyoho and others added 3 commits April 27, 2022 09:22
Co-authored-by: patak <matias.capeletto@gmail.com>
@patak-dev patak-dev added the p3-minor-bug An edge case that only affects very specific usage (priority) label May 2, 2022
@patak-dev patak-dev merged commit 2b58cb3 into vitejs:main May 4, 2022
@poyoho poyoho deleted the fix/html-unexpect-url branch May 5, 2022 01:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

index.html 在build的时候需要忽略里面的一些处理
2 participants