Skip to content

Commit

Permalink
lodash vite config
Browse files Browse the repository at this point in the history
  • Loading branch information
Smef committed Jun 4, 2024
1 parent 2deba38 commit bf47b6e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,21 @@ export default defineNuxtModule<ModuleOptions>({

addImportsDir(resolver.resolve('./runtime/composables'))
addServerImportsDir(resolver.resolve('./runtime/server/utils'))

_nuxt.hook('vite:extendConfig', (config) => {
config.optimizeDeps = config.optimizeDeps || {}
config.optimizeDeps.include = config.optimizeDeps.include || []
config.optimizeDeps.exclude = config.optimizeDeps.exclude || []

const lodashIndex
= config.optimizeDeps.exclude.indexOf('lodash')
if (lodashIndex > -1) {
config.optimizeDeps.exclude.splice(lodashIndex, 1)
}

if (!config.optimizeDeps.include.includes('lodash')) {
config.optimizeDeps.include.push('lodash')
}
})
},
})
2 changes: 1 addition & 1 deletion src/runtime/composables/useForm.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { isEqual } from 'lodash.isequal/index.js'
import isEqual from 'lodash/isequal.js'
import { reactive, watch } from 'vue'
import type { NitroFetchRequest } from 'nitropack'
import type FormDataConvertible from '~/types/FormDataconvertible'
Expand Down

0 comments on commit bf47b6e

Please sign in to comment.