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: normalize postcss dependency messages #6959

Merged
merged 3 commits into from Feb 17, 2022

Conversation

sibbng
Copy link
Contributor

@sibbng sibbng commented Feb 17, 2022

Description

It seems Vite normalizes dir-dependency messages but not dependency messages.

On my Windows machine, files defined in tailwind.config.js without glob patterns was not triggering HMR updates for CSS files.

Tailwind sends dependency message for non-glob patterns and dir-dependency message for glob patterns:
https://github.com/tailwindlabs/tailwindcss/blob/23b1b301a11178697db6f0b12785f99945fe0ef4/src/util/parseDependency.js#L35-L40

Take this config as reference:

  content: [
    './index.html',
    './src/App.vue',
    './src/components/**/*.vue',
  ],

Changes in files matching with ./src/components/**/*.vue pattern will trigger CSS HMR for those files, but changes in ./src/App.vue will not.

Reproduction:
https://github.com/sibbng/vite-tailwind-repro

Steps:

  • Get a Windows machine
  • Change bg color in App.vue, change will not trigger HMR for style.css
  • Change bg color in HelloWorld.vue, change will trigger HMR for style.css and both div's background should be updated

Additional context

This issue could potentially fix #5808. But this bug report comes from a macOS user and there is no reproduction.

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.

@Niputi
Copy link
Contributor

Niputi commented Feb 17, 2022

could you add a test to the tailwind playground?

@sibbng
Copy link
Contributor Author

sibbng commented Feb 17, 2022

could you add a test to the tailwind playground?

Done 👍

@patak-dev patak-dev merged commit 3f3f473 into vitejs:main Feb 17, 2022
@sibbng sibbng deleted the fix/normalize-postcss-dependecy branch February 17, 2022 21:38
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.

None yet

3 participants