Enable SWC plugin cache invalidation for external file dependencies #86782
soujvnunes
started this conversation in
Ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Goals
Non-Goals
Background
I'm building tailwind-expand, a set of plugins that transform CSS component aliases into Tailwind utility classes at build time.
The @tailwind-expand/swc plugin works by:
expandat-rule blocks)classNameattributesCurrent limitation: When users modify their CSS aliases, changes aren't reflected until the dev server restarts because:
For @tailwind-expand/vite, this was resolved by using
server.restart(). No equivalent exists for Turbopack.Current workaround:
nodemon(inspiration: NextJS Tip: Hot reloading for dynamic servers) to auto-restart the server, but this loses React state and is slow.Proposal
A configuration option to declare file dependencies for SWC plugins:
When watched files change, Turbopack would invalidate cached transforms for modules processed by that plugin and re-run the plugin's config-time setup.
Alternative approaches:
I'm happy to contribute if given guidance on the preferred approach
Beta Was this translation helpful? Give feedback.
All reactions