From 76adabcdc24583e034b72564d45ec2f5e08619c9 Mon Sep 17 00:00:00 2001 From: IWANABETHATGUY Date: Sat, 14 Sep 2024 11:54:48 +0800 Subject: [PATCH] =?UTF-8?q?perf:=20=E2=9A=A1=EF=B8=8F=20use=20default=20re?= =?UTF-8?q?solver?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vite/src/node/build.ts | 4 +-- packages/vite/src/node/plugins/index.ts | 36 +++++++++++++------------ 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/packages/vite/src/node/build.ts b/packages/vite/src/node/build.ts index f8c1067e912bd2..3e007a3b4ee62a 100644 --- a/packages/vite/src/node/build.ts +++ b/packages/vite/src/node/build.ts @@ -456,9 +456,7 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{ ].filter(Boolean) as Plugin[], post: [ ...buildImportAnalysisPlugin(config), - ...(config.esbuild !== false && !enableNativePlugin - ? [buildEsbuildPlugin(config)] - : []), + ...(config.esbuild !== false ? [buildEsbuildPlugin(config)] : []), ...(options.minify ? [terserPlugin(config)] : []), ...((!config.isWorker ? [ diff --git a/packages/vite/src/node/plugins/index.ts b/packages/vite/src/node/plugins/index.ts index 586e36db56757b..7802fd381e6624 100644 --- a/packages/vite/src/node/plugins/index.ts +++ b/packages/vite/src/node/plugins/index.ts @@ -80,23 +80,25 @@ export async function resolvePlugins( }) : modulePreloadPolyfillPlugin(config) : null, - resolvePlugin({ - ...config.resolve, - root: config.root, - isProduction: config.isProduction, - isBuild, - packageCache: config.packageCache, - ssrConfig: config.ssr, - asSrc: true, - fsUtils: getFsUtils(config), - getDepsOptimizer: isBuild - ? undefined - : (ssr: boolean) => getDepsOptimizer(config, ssr), - shouldExternalize: - isBuild && config.build.ssr - ? (id, importer) => shouldExternalizeForSSR(id, importer, config) - : undefined, - }), + enableNativePlugin + ? null + : resolvePlugin({ + ...config.resolve, + root: config.root, + isProduction: config.isProduction, + isBuild, + packageCache: config.packageCache, + ssrConfig: config.ssr, + asSrc: true, + fsUtils: getFsUtils(config), + getDepsOptimizer: isBuild + ? undefined + : (ssr: boolean) => getDepsOptimizer(config, ssr), + shouldExternalize: + isBuild && config.build.ssr + ? (id, importer) => shouldExternalizeForSSR(id, importer, config) + : undefined, + }), htmlInlineProxyPlugin(config), cssPlugin(config), config.esbuild !== false