Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
feat: support vite 3.1
  • Loading branch information
antfu committed Sep 18, 2022
1 parent 6d09ebd commit 16c8c55
Show file tree
Hide file tree
Showing 4 changed files with 127 additions and 276 deletions.
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -99,7 +99,7 @@
"unocss": "workspace:*",
"unplugin-auto-import": "^0.11.2",
"unplugin-vue-components": "^0.22.7",
"vite": "3.1.0",
"vite": "^3.1.2",
"vite-plugin-inspect": "^0.7.1",
"vite-plugin-pages": "^0.26.0",
"vitest": "^0.23.4",
Expand All @@ -109,7 +109,7 @@
"pnpm": {
"overrides": {
"@nuxt/kit-edge": "npm:@nuxt/kit@latest",
"vite": "3.0.9"
"vite": "^3.1.2"
}
},
"simple-git-hooks": {
Expand Down
5 changes: 4 additions & 1 deletion packages/vite/src/modes/global/build.ts
Expand Up @@ -125,7 +125,10 @@ export function GlobalModeBuildPlugin({ uno, ready, extract, tokens, filter, get
css = await applyCssTransform(css, fakeCssId, options.dir)

const hash = getHash(css)
await cssPost.transform!.call({} as any, getHashPlaceholder(hash), fakeCssId)
const transformHandler = 'handler' in cssPost.transform!
? cssPost.transform.handler
: cssPost.transform!
await transformHandler.call({} as any, getHashPlaceholder(hash), fakeCssId)

// fool the css plugin to generate the css in corresponding chunk
chunk.modules[fakeCssId] = {
Expand Down
2 changes: 2 additions & 0 deletions playground/src/auto-imports.d.ts
Expand Up @@ -124,6 +124,7 @@ declare global {
const useCeil: typeof import('@vueuse/math')['useCeil']
const useClamp: typeof import('@vueuse/math')['useClamp']
const useClipboard: typeof import('@vueuse/core')['useClipboard']
const useCloned: typeof import('@vueuse/core')['useCloned']
const useColorMode: typeof import('@vueuse/core')['useColorMode']
const useConfirmDialog: typeof import('@vueuse/core')['useConfirmDialog']
const useCounter: typeof import('@vueuse/core')['useCounter']
Expand Down Expand Up @@ -201,6 +202,7 @@ declare global {
const usePointerSwipe: typeof import('@vueuse/core')['usePointerSwipe']
const usePrecision: typeof import('@vueuse/math')['usePrecision']
const usePreferredColorScheme: typeof import('@vueuse/core')['usePreferredColorScheme']
const usePreferredContrast: typeof import('@vueuse/core')['usePreferredContrast']
const usePreferredDark: typeof import('@vueuse/core')['usePreferredDark']
const usePreferredLanguages: typeof import('@vueuse/core')['usePreferredLanguages']
const usePreferredReducedMotion: typeof import('@vueuse/core')['usePreferredReducedMotion']
Expand Down

0 comments on commit 16c8c55

Please sign in to comment.