Skip to content

Commit

Permalink
feat: default esbuild jsxDev based on config.isProduction (#12386)
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnaudBarre authored Mar 13, 2023
1 parent b12f457 commit f24c2b0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions packages/vite/src/node/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export type ResolvedConfig = Readonly<
alias: Alias[]
}
plugins: readonly Plugin[]
esbuild: ESBuildOptions | false
server: ResolvedServerOptions
build: ResolvedBuildOptions
preview: ResolvedPreviewOptions
Expand Down Expand Up @@ -657,6 +658,13 @@ export async function resolveConfig(
mainConfig: null,
isProduction,
plugins: userPlugins,
esbuild:
config.esbuild === false
? false
: {
jsxDev: !isProduction,
...config.esbuild,
},
server,
build: resolvedBuildOptions,
preview: resolvePreviewOptions(config.preview, server),
Expand Down
2 changes: 1 addition & 1 deletion packages/vite/src/node/plugins/esbuild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ export async function transformWithEsbuild(
}
}

export function esbuildPlugin(options: ESBuildOptions = {}): Plugin {
export function esbuildPlugin(options: ESBuildOptions): Plugin {
const filter = createFilter(
options.include || /\.(m?ts|[jt]sx)$/,
options.exclude || /\.js$/,
Expand Down

0 comments on commit f24c2b0

Please sign in to comment.