Skip to content

fix(css): use single postcss instance#13738

Merged
patak-cat merged 1 commit intovitejs:mainfrom
sapphi-red:fix/single-postcss-instance
Jul 7, 2023
Merged

fix(css): use single postcss instance#13738
patak-cat merged 1 commit intovitejs:mainfrom
sapphi-red:fix/single-postcss-instance

Conversation

@sapphi-red
Copy link
Copy Markdown
Member

Description

compileCSS function calls PostCSS inside and #8400 used compileCSS function inside the post-css-import's load option.
This causes a different PostCSS instance to be used inside @import and broke #13732. Also I guess running multiple PostCSS instances will hurt performance if tailwind is used since tailwind will crawl the files for every PostCSS instance.

This PR extracts the preprocessor part of compileCSS function to compileCSSPreprocessor function and uses that function in the post-css-import's load option. I found that #8400 didn't implement sourcemap support but I didn't implemented that because it would be complicated.

close #13732
refs #8400

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.

@sapphi-red sapphi-red added feat: css p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release labels Jul 7, 2023
@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@sapphi-red
Copy link
Copy Markdown
Member Author

/ecosystem-ci run

@vite-ecosystem-ci
Copy link
Copy Markdown

vite-ecosystem-ci bot commented Jul 7, 2023

📝 Ran ecosystem CI: Open

suite result
analogjs ✅ success
astro ✅ success
histoire ❌ failure
iles ❌ failure
ladle ✅ success
laravel ✅ success
marko ✅ success
nuxt ✅ success
nx ✅ success
previewjs ✅ success
qwik ✅ success
rakkas ✅ success
sveltekit ✅ success
unocss ❌ failure
vite-plugin-pwa ✅ success
vite-plugin-ssr ✅ success
vite-plugin-react ✅ success
vite-plugin-react-pages ✅ success
vite-plugin-react-swc ✅ success
vite-plugin-svelte ✅ success
vite-plugin-vue ✅ success
vite-setup-catalogue ✅ success
vitepress ✅ success
vitest ✅ success

Copy link
Copy Markdown
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

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

Interesting, I overlooked of the case for normal CSS imports, where before #8400 it was already working without a separate compile. Looks like we indeed only need to handle preprocessing here.

@patak-cat patak-cat merged commit c02fac4 into vitejs:main Jul 7, 2023
@sapphi-red sapphi-red deleted the fix/single-postcss-instance branch July 7, 2023 10:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feat: css p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@Tailwind Base no longer resolving in imported stylesheets

3 participants