Skip to content
This repository was archived by the owner on Sep 20, 2024. It is now read-only.

Commit 1ba79c6

Browse files
committed
fix: include internal lodash modules to nuxt optimixed dependencies
1 parent 51a8758 commit 1ba79c6

File tree

3 files changed

+17
-2
lines changed

3 files changed

+17
-2
lines changed

modules/nuxt/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
"@emotion/server": "^11.10.0",
3737
"@nuxt/kit": "^3.2.0",
3838
"@nuxtjs/emotion": "1.0.0",
39+
"defu": "^6.1.2",
3940
"playwright": "^1.30.0"
4041
},
4142
"devDependencies": {

modules/nuxt/src/module.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import type * as Theme from "@chakra-ui/theme"
1010
import type * as ChakraUI from "@chakra-ui/vue-next"
1111
import * as Chakra from "@chakra-ui/vue-next"
1212
import mergeWith from "lodash.mergewith"
13+
import { defu } from "defu"
1314

1415
const { extendTheme: _extendTheme } = Chakra
1516
const ChakraPlugin = Chakra.default
@@ -113,6 +114,18 @@ export default defineNuxtModule<ChakraModuleOptions>({
113114
const runtimeDir = resolve("./runtime")
114115
nuxt.options.build.transpile.push(runtimeDir)
115116

117+
// Include all internal lodash modules
118+
// to the optimized dependencies since they do not
119+
// natively export ESM modules.
120+
const viteConfig = nuxt.options.vite || {}
121+
const extendedViteConfigOptions = {
122+
optimizeDeps: {
123+
include: ["lodash.mergewith", "lodash.camelcase", "lodash.memoize"],
124+
},
125+
}
126+
const finalViteConfig = defu(viteConfig, extendedViteConfigOptions)
127+
nuxt.options.vite = finalViteConfig
128+
116129
// Add emotion plugins
117130
addServerPlugin(resolve(runtimeDir, "emotion.server"))
118131
addPlugin(resolve(runtimeDir, "emotion.client"))

pnpm-lock.yaml

Lines changed: 3 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)