Skip to content

fix(build): invalidate chunk hash when css changed - #11475

Merged
patak-cat merged 2 commits into
mainfrom
build-css-hash
Dec 23, 2022
Merged

patak-cat merged 2 commits into
mainfrom
build-css-hash

Conversation

@bluwy

@bluwy bluwy commented Dec 23, 2022

Copy link
Copy Markdown
Member

Description

fix #9583

Use Rollup's augmentChunkHash hook to ensure hash takes account of chunk.viteMetadata.importedCss

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 PR Title 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.

@bluwy bluwy added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) feat: build labels Dec 23, 2022
Comment thread packages/vite/src/node/plugins/css.ts Resolved
patak-cat
patak-cat previously approved these changes Dec 23, 2022
@patak-cat

Copy link
Copy Markdown
Member

/ecosystem-ci run

@vite-ecosystem-ci

vite-ecosystem-ci Bot commented Dec 23, 2022 •

Copy link
Copy Markdown

📝 Ran ecosystem CI: Open

suite result
astro ✅ success
histoire ✅ success
iles ✅ success
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt-framework ✅ success
previewjs ✅ success
rakkas ✅ success
sveltekit ✅ success
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ❌ failure
windicss ✅ success

@bluwy

bluwy commented Dec 23, 2022

Copy link
Copy Markdown
Member Author

Looks like there's this TypeError: Cannot read properties of undefined (reading 'importedCss') error in Vitest. I'm not sure how that happens since we always add the metadata to all chunks in the metadata plugin, but I added an optional chain anyways to workaround the issue for now.

@patak-cat

Copy link
Copy Markdown
Member

/ecosystem-ci run vitest

@vite-ecosystem-ci

vite-ecosystem-ci Bot commented Dec 23, 2022 •

Copy link
Copy Markdown

📝 Ran ecosystem CI: Open

suite result
vitest ✅ success

@patak-cat
patak-cat merged commit 7a97a04 into main Dec 23, 2022
@patak-cat
patak-cat deleted the build-css-hash branch December 23, 2022 14:51
@tessro

tessro commented Dec 23, 2022

Copy link
Copy Markdown

Thank you!! ❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: build feat: css 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.

hash of the main chunk not changed when only modify dynamic sub component css code

3 participants