Skip to content

Commit

Permalink
feat: support enabled flag
Browse files Browse the repository at this point in the history
  • Loading branch information
antfu committed Sep 10, 2021
1 parent c321373 commit 8e1ef8a
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions src/node/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,24 @@ import { ModuleInfo, TransformInfo } from '../types'

const debug = _debug('vite-plugin-inspect')

function VitePluginPackageConfig(): Plugin {
export interface Options {
/**
* Enable the inspect plugin (could be some performance overhead)
*
* @default true
*/
enabled: boolean
}

function PluginInspect({
enabled = true,
} = {}): Plugin {
if (!enabled) {
return {
name: 'vite-plugin-inspect',
}
}

let config: ResolvedConfig

const transformMap: Record<string, TransformInfo[]> = {}
Expand Down Expand Up @@ -171,4 +188,4 @@ function VitePluginPackageConfig(): Plugin {
}
}

export default VitePluginPackageConfig
export default PluginInspect

0 comments on commit 8e1ef8a

Please sign in to comment.