feat(nitro): support esbuild options config (#550)

This commit is contained in:
Xin Du (Clark) 2021-09-22 15:39:54 +01:00 committed by GitHub
parent 317fc55539
commit a137d2e5ec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 1 deletions

View File

@ -12,6 +12,7 @@ import type { StorageOptions } from './rollup/plugins/storage'
import type { AssetOptions } from './rollup/plugins/assets'
import type { ServerMiddleware } from './server/middleware'
import type { RollupConfig } from './rollup/config'
import type { Options as EsbuildOptions } from './rollup/plugins/esbuild'
export interface NitroHooks {
'nitro:document': (htmlTemplate: { src: string, contents: string, dst: string, compiled: string }) => void
@ -31,6 +32,9 @@ export interface NitroContext {
node: boolean
preset: string
rollupConfig?: RollupConfig
esbuild?: {
options?: EsbuildOptions
}
moduleSideEffects: string[]
renderer: string
serveStatic: boolean

View File

@ -158,7 +158,8 @@ export const getRollupConfig = (nitroContext: NitroContext) => {
// ESBuild
rollupConfig.plugins.push(esbuild({
target: 'es2019',
sourceMap: true
sourceMap: true,
...nitroContext.esbuild?.options
}))
// Dynamic Require Support