Skip to content

Commit 9612282

Browse files
committed
fix(plugin-debug): avoid enabling in production mode (close #53)
1 parent 3174f5a commit 9612282

File tree

1 file changed

+13
-4
lines changed
  • packages/@vuepress/plugin-debug/src

1 file changed

+13
-4
lines changed
Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,21 @@
1-
import type { Plugin } from '@vuepress/core'
1+
import type { Plugin, PluginObject } from '@vuepress/core'
22
import { path } from '@vuepress/utils'
33

44
export type DebugPluginOptions = Record<never, never>
55

6-
export const debugPlugin: Plugin<DebugPluginOptions> = {
7-
name: '@vuepress/plugin-debug',
6+
export const debugPlugin: Plugin<DebugPluginOptions> = (_, app) => {
7+
const pluginObj: PluginObject = {
8+
name: '@vuepress/plugin-debug',
9+
}
810

9-
clientAppRootComponentFiles: path.resolve(__dirname, './components/Debug.js'),
11+
if (app.env.isDev || app.env.isDebug) {
12+
pluginObj.clientAppRootComponentFiles = path.resolve(
13+
__dirname,
14+
'./components/Debug.js'
15+
)
16+
}
17+
18+
return pluginObj
1019
}
1120

1221
export default debugPlugin

0 commit comments

Comments
 (0)