From a051e66f1ae211174cf470d4430427dc0189194b Mon Sep 17 00:00:00 2001 From: Evan You Date: Sun, 5 Dec 2021 23:28:34 +0800 Subject: [PATCH] fix: lazy require @vitejs/plugin-vue to respect NODE_ENV --- src/node/plugin.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/node/plugin.ts b/src/node/plugin.ts index 46f8a7e0affb..056796a0a539 100644 --- a/src/node/plugin.ts +++ b/src/node/plugin.ts @@ -6,7 +6,6 @@ import { MarkdownCompileResult } from './markdownToVue' import { DIST_CLIENT_PATH, APP_PATH, SITE_DATA_REQUEST_PATH } from './alias' -import createVuePlugin from '@vitejs/plugin-vue' import { slash } from './utils/slash' import { OutputAsset, OutputChunk } from 'rollup' @@ -55,7 +54,8 @@ export function createVitePressPlugin( publicDir: string ) => MarkdownCompileResult - const vuePlugin = createVuePlugin({ + // lazy require plugin-vue to respect NODE_ENV in @vue/compiler-x + const vuePlugin = require('@vitejs/plugin-vue')({ include: [/\.vue$/, /\.md$/], ...userVuePluginOptions })