diff --git a/src/node/build/index.ts b/src/node/build/index.ts index c9a21eab07b2ca..a13bf4e2e76cf3 100644 --- a/src/node/build/index.ts +++ b/src/node/build/index.ts @@ -93,7 +93,8 @@ export async function createBaseRollupPlugins( rollupInputOptions = {}, transforms = [], vueCustomBlockTransforms = {}, - cssPreprocessOptions + cssPreprocessOptions, + enableEsbuild = true } = options const { nodeResolve } = require('@rollup/plugin-node-resolve') const dynamicImport = require('rollup-plugin-dynamic-import-variables') @@ -108,7 +109,9 @@ export async function createBaseRollupPlugins( // vite:resolve createBuildResolvePlugin(root, resolver), // vite:esbuild - await createEsbuildPlugin(options.minify === 'esbuild', options.jsx), + enableEsbuild + ? await createEsbuildPlugin(options.minify === 'esbuild', options.jsx) + : null, // vue require('rollup-plugin-vue')({ ...options.rollupPluginVueOptions, diff --git a/src/node/config.ts b/src/node/config.ts index 3a2fd3317cb0fe..2a33c230d59115 100644 --- a/src/node/config.ts +++ b/src/node/config.ts @@ -117,6 +117,11 @@ export interface SharedConfig { * CSS preprocess options */ cssPreprocessOptions?: SFCStyleCompileOptions['preprocessOptions'] + /** + * Enable esbuild + * @default true + */ + enableEsbuild?: boolean } export interface ServerConfig extends SharedConfig { diff --git a/src/node/server/index.ts b/src/node/server/index.ts index 980fc5227cd929..2512b449679d95 100644 --- a/src/node/server/index.ts +++ b/src/node/server/index.ts @@ -54,7 +54,8 @@ export function createServer(config: ServerConfig): Server { alias = {}, transforms = [], vueCustomBlockTransforms = {}, - optimizeDeps = {} + optimizeDeps = {}, + enableEsbuild = true } = config const app = new Koa() @@ -98,14 +99,14 @@ export function createServer(config: ServerConfig): Server { : []), vuePlugin, cssPlugin, - esbuildPlugin, + enableEsbuild ? esbuildPlugin : null, jsonPlugin, assetPathPlugin, webWorkerPlugin, wasmPlugin, serveStaticPlugin ] - resolvedPlugins.forEach((m) => m(context)) + resolvedPlugins.forEach((m) => m && m(context)) const listen = server.listen.bind(server) server.listen = (async (...args: any[]) => {