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

feat: sharedDuringBuild unocss plugin #57

Merged
merged 17 commits into from
Apr 30, 2024
Merged

feat: sharedDuringBuild unocss plugin #57

merged 17 commits into from
Apr 30, 2024

Conversation

hi-ogawa
Copy link
Owner

@hi-ogawa hi-ogawa commented Apr 29, 2024

Experimenting with Plugin.create and sharedDuringBuild introduced in vitejs/vite#16471 (comment)

summary

  • Token extraction is done for all environments using transform hook
  • virtual:unocss.css is imported by single environment ("client" in my case)
    • During dev, this will set up HMR via environment.hot
    • During build, this will set up "delayed" css transform based on renderChunk + vite:css-post trick.
      Since the build order is react-server -> client, at the time of client renderChunk, it has collected all tokens from both environments.

todo

  • dev, hmr, fouc
  • build
  • test
  • feedback
    • create is awesome
      • since create(environment) already gives environment.moduleGraph, hot, etc... during dev, configureServer(server) was not necessary.

@hi-ogawa hi-ogawa changed the title feat: unocss plugin with sharedDuringBuild feat: sharedDuringBuild unocss plugin Apr 29, 2024
@hi-ogawa hi-ogawa marked this pull request as ready for review April 29, 2024 11:00
@hi-ogawa hi-ogawa merged commit 334df37 into main Apr 30, 2024
1 check passed
@hi-ogawa hi-ogawa deleted the feat-shared-plugin branch April 30, 2024 00:36
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.

1 participant