@@ -8,12 +8,14 @@ import {
88import type * as NuxtSchema from "@nuxt/schema"
99import type * as Theme from "@chakra-ui/theme"
1010import type * as ChakraUI from "@chakra-ui/vue-next"
11- import * as Chakra from "@chakra-ui/vue-next"
11+ import {
12+ ChakraComponents ,
13+ extendTheme as _extendTheme ,
14+ } from "@chakra-ui/vue-next"
1215import mergeWith from "lodash.mergewith"
1316import { defu } from "defu"
1417
15- const { extendTheme : _extendTheme } = Chakra
16- const ChakraPlugin = Chakra . default
18+ // const { extendTheme: _extendTheme } = Chakra
1719
1820/** Chakra UI Vue SSR Context State */
1921export interface ChakraUISSRContext {
@@ -77,26 +79,29 @@ export default defineNuxtModule<ChakraModuleOptions>({
7779
7880 // Transpile
7981 nuxt . options . build . transpile . push ( "@chakra-ui/vue-next" )
82+ nuxt . options . build . transpile . push ( "@emotion/server" )
83+ nuxt . options . build . transpile . push ( "@emotion/css" )
84+ nuxt . options . build . transpile . push ( "@emotion/css/create-instance" )
8085
8186 // Auto-import components
82- for ( const component in Chakra ) {
87+ for ( const component in ChakraComponents ) {
8388 /**
8489 * Group of strict checks to make sure that
8590 * we only generate types for components.
8691 */
8792 if (
8893 component . startsWith ( "C" ) &&
8994 // @ts -ignore
90- Chakra [ component ] ?. name &&
95+ ChakraComponents [ component ] ?. name &&
9196 // @ts -ignore
92- Chakra [ component ] ?. setup &&
97+ ChakraComponents [ component ] ?. setup &&
9398 // @ts -ignore
94- typeof Chakra [ component ] ?. setup === "function"
99+ typeof ChakraComponents [ component ] ?. setup === "function"
95100 ) {
96101 addComponent ( {
97102 name : component ,
98103 // @ts -ignore
99- export : Chakra [ component ] ?. name ,
104+ export : ChakraComponents [ component ] ?. name ,
100105 filePath : "@chakra-ui/vue-next" ,
101106 } )
102107 }
@@ -121,7 +126,13 @@ export default defineNuxtModule<ChakraModuleOptions>({
121126 const viteConfig = nuxt . options . vite || { }
122127 const extendedViteConfigOptions = {
123128 optimizeDeps : {
124- include : [ "lodash.mergewith" , "lodash.camelcase" , "lodash.memoize" ] ,
129+ include : [
130+ "lodash.mergewith" ,
131+ "lodash.camelcase" ,
132+ "lodash.memoize" ,
133+ "@emotion/server" ,
134+ "@emotion/css" ,
135+ ] ,
125136 } ,
126137 }
127138 const finalViteConfig = defu ( viteConfig , extendedViteConfigOptions )
0 commit comments