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

Pick up changes from files that are both context and content deps #9787

Merged
merged 3 commits into from Nov 9, 2022

Conversation

thecrypticace
Copy link
Contributor

@thecrypticace thecrypticace commented Nov 9, 2022

We switched to absolute paths and it broke this revealing a lurking bug. Fun.

Fixes #9763

@thecrypticace thecrypticace merged commit aac468c into master Nov 9, 2022
@thecrypticace thecrypticace deleted the fix/shared-file-dep-types branch November 9, 2022 15:22
@zigomir
Copy link

zigomir commented Dec 16, 2022

This change negatively affects Vite HMR performance with Vue 3 on our project. File change updates used to be almost instant and now take several seconds.

We're on currently latest vite@4.0.1 and vue@3.2.45. Besides main entry js file which does import 'tailwindcss/tailwind.css', we also have two SFC Custom Elements with own Tailwind directives inside SFC's style element.

@tailwind base;
@tailwind components;
@tailwind utilities;

Removing these helps a bit, but of course breaks our styles.

Do you think there's a possible workaround for this, other than downgrading to v3.2.2? Thanks!

@thecrypticace
Copy link
Contributor Author

Can you please open an issue with a reproduction? It seems unlikely to me that this would cause such a significant slowdown but as noted in the comment it's not really the "right' fix for the problem.

@zigomir
Copy link

zigomir commented Dec 21, 2022

@thecrypticace I prepared reproduction, see zigomir/vite-tailwind-regression#1

Repo has been made with npm create vite@latest from https://vitejs.dev/guide/ + https://tailwindcss.com/docs/guides/vite

Instead of reverting from 3.2.4 to 3.2.2 (I'm aware 3.2.3 introduces regression), you can also directly change content.js in node_modules to observe sam perf regression.

-if (modified >= prevModified) {
+if (modified > prevModified) {

@thecrypticace
Copy link
Contributor Author

Okay, yeah there is definitely a regression here. However, at least for the reproduction, there's a fairly simple workaround for the situation.

Your content paths include all of node_modules:

content: [
    "./index.html",
    "./**/*.{js,ts,jsx,tsx}",
],

This ends up scanning almost 1700 files totaling about 13.7MB.

I would recommend scanning only the files you want. Since there's no src folder or something similar you can exclude node_modules from being scanned:

content: [
    "./index.html",
    "./**/*.{js,ts,jsx,tsx}",
    "!./node_modules", // This is the new line -- note the ! in front
],

I'll look into implementing a more proper fix for the content + context deps change detection. Thanks!

@thecrypticace
Copy link
Contributor Author

@zigomir This has been fixed and will be available in our insiders build (should be just a few minutes). I've tested it against your project and the project from the original issue and both are fixed! :)

Thanks for the repro! It was helpful!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TailwindCSS > 3.1.8 in linux doesn't resolve content paths correctly
2 participants