Skip to content

feat: sharedDuringBuild unocss plugin#57

Merged
hi-ogawa merged 17 commits into
mainfrom
feat-shared-plugin
Apr 30, 2024
Merged

feat: sharedDuringBuild unocss plugin#57
hi-ogawa merged 17 commits into
mainfrom
feat-shared-plugin

Conversation

@hi-ogawa
Copy link
Copy Markdown
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
@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