Skip to content

Commit

Permalink
fix(nuxt): exclude .nuxt
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Aug 24, 2021
1 parent e584a86 commit 3e6cebd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/core/transform.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ export function transform(code: string, id: string, { matchRE, imports }: Transf

// group by module name
Array.from(matched).forEach((name) => {
const moduleName = imports[name].module
const moduleName = imports[name]?.module
if (!moduleName)
return
if (!modules[moduleName])
modules[moduleName] = []
modules[moduleName].push(imports[name])
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default createUnplugin<Options>((options) => {
const resolved = resolveOptions(options)

if (!Object.keys(resolved.imports).length)
console.warn('[auto-imports] plugin installed but no imports has defined, see https://github.com/antfu/unplugin-auto-import#configurations for configurations')
console.warn('[auto-import] plugin installed but no imports has defined, see https://github.com/antfu/unplugin-auto-import#configurations for configurations')

if (resolved.dts)
fs.writeFile(resolved.dts, generateDeclration(resolved.imports), 'utf-8')
Expand Down
2 changes: 2 additions & 0 deletions src/nuxt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { Options } from './types'
import unplugin from '.'

export default function(this: any, options: Options) {
options.exclude = options.exclude || [/node_modules/, /\.git/, /\.nuxt/]

// install webpack plugin
this.extendBuild((config: any) => {
config.plugins = config.plugins || []
Expand Down

0 comments on commit 3e6cebd

Please sign in to comment.