-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Prevent accidental CSS inclusion in dev #7381
Conversation
🦋 Changeset detectedLatest commit: cef3a44 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
if (isImportedBy(id, importedModule) && !isPropagationStoppingPoint) { | ||
importedModules.add(importedModule); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
On line 47, maybe we can do this instead?
- for (const importedModule of entry.importedModules) {
+ for (const importedModule of entry.ssrTransformResult.deps) {
Assuming ssrTransformResult
would always exist since we're running the Astro component in SSR. .ssrTransformResult.deps
should contain the direct imports during Vite's SSR transformation. It's an array of strings, so we'd need to call Vite's moduleGraph.getModuleByUrl()
for each string to get the ModuleNode
(might need to extend the loader
). This is a bit similar to #6716 when I was refactoring it.
If this doesn't quite work, I think this current solution is fine too.
Tailwind strikes again 😦
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if this might not be the place for such a question, but I'm curious.
What's the problem with tailwind? What does it do that causes so much nuance in Astro?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is a problem with Tailwind so much. They aren't doing anything wrong here. This comes down to the Vite API changing and us using the new one incorrectly.
Thanks @bluwy I'll give that option a try.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ssrTransformResult.deps
will work. It is urls (paths), so need to compare against entry.url
.
Changes
importedModules
to be true imports. It includes stuff tracked for HMR.importers
to verify that an import is an import.Testing
Docs
N/A