Skip to content

Commit

Permalink
perf: reduce pre alias plugin in build mode
Browse files Browse the repository at this point in the history
  • Loading branch information
IWANABETHATGUY committed Sep 12, 2024
1 parent d9e00de commit 16d34d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
6 changes: 4 additions & 2 deletions packages/vite/src/node/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import {
requireResolveFromRootWithFallback,
} from './utils'
import { manifestPlugin } from './plugins/manifest'
import type { Logger } from './logger';
import type { Logger } from './logger'
import { LogLevels } from './logger'
import { dataURIPlugin } from './plugins/dataUri'
import { buildImportAnalysisPlugin } from './plugins/importAnalysisBuild'
Expand Down Expand Up @@ -455,7 +455,9 @@ export async function resolveBuildPlugins(config: ResolvedConfig): Promise<{
].filter(Boolean) as Plugin[],
post: [
...buildImportAnalysisPlugin(config),
...(config.esbuild !== false ? [buildEsbuildPlugin(config)] : []),
...(config.esbuild !== false && !enableNativePlugin
? [buildEsbuildPlugin(config)]
: []),
...(options.minify ? [terserPlugin(config)] : []),
...((!config.isWorker
? [
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export async function resolvePlugins(
depsOptimizerEnabled ? optimizedDepsPlugin(config) : null,
isBuild ? metadataPlugin() : null,
!isWorker ? watchPackageDataPlugin(config.packageCache) : null,
preAliasPlugin(config),
!isBuild ? preAliasPlugin(config) : null,
enableNativePlugin
? nativeAliasPlugin({
entries: config.resolve.alias.map((item) => {
Expand Down

0 comments on commit 16d34d1

Please sign in to comment.