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(css): use single postcss instance #13738

Merged
merged 1 commit into from Jul 7, 2023

Conversation

sapphi-red
Copy link
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
@stackblitz
Copy link

stackblitz bot commented Jul 7, 2023

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

@sapphi-red
Copy link
Member Author

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

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
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-dev patak-dev merged commit c02fac4 into vitejs:main Jul 7, 2023
13 checks passed
@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