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(hmr): hmr style tag no support in html #7052

Merged
merged 6 commits into from Feb 24, 2022
Merged

Conversation

poyoho
Copy link
Member

@poyoho poyoho commented Feb 23, 2022

Description

fix: #7042

Additional context

This PR make style tag to script proxy make it had hmr. Because @import will add module deps in index.html so make it proxy to css plugins to process the serve module graph deps.


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.

Copy link
Member

@ygj6 ygj6 left a comment

Choose a reason for hiding this comment

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

LGTM

@patak-dev patak-dev merged commit a9dfce3 into vitejs:main Feb 24, 2022
s.overwrite(
node.loc.start.offset,
node.loc.end.offset,
`<script type="module" src="${modulePath}"></script>`
Copy link
Contributor

Choose a reason for hiding this comment

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

I think if the type is css, this shouldn't be a script type="module", I think that's causing #7124.

Copy link
Member Author

Choose a reason for hiding this comment

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

but no module css, it generate code can't run

Copy link
Member Author

Choose a reason for hiding this comment

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

import {createHotContext as __vite__createHotContext} from "/@vite/client";
import.meta.hot = __vite__createHotContext("/dep.css");
import {updateStyle as __vite__updateStyle, removeStyle as __vite__removeStyle} from "/@vite/client"

@poyoho poyoho deleted the fix/style-hmr branch March 1, 2022 01:36
@poyoho poyoho restored the fix/style-hmr branch March 2, 2022 02:20
@poyoho poyoho deleted the fix/style-hmr branch March 2, 2022 02:35
sinoon pushed a commit to sinoon/vite that referenced this pull request Mar 2, 2022
poyoho added a commit to poyoho/vite that referenced this pull request Mar 11, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

<style>@import "./style.css";</style> fails to HMR
5 participants