mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-22 13:45:18 +00:00
fix(webpack): use modern target for esbuild
This commit is contained in:
parent
8a1cb84518
commit
ae32ca42fa
@ -4,6 +4,11 @@ import { WebpackConfigContext } from '../utils/config'
|
|||||||
export function esbuild (ctx: WebpackConfigContext) {
|
export function esbuild (ctx: WebpackConfigContext) {
|
||||||
const { config } = ctx
|
const { config } = ctx
|
||||||
|
|
||||||
|
// https://esbuild.github.io/getting-started/#bundling-for-the-browser
|
||||||
|
// https://gs.statcounter.com/browser-version-market-share
|
||||||
|
// https://nodejs.org/en/
|
||||||
|
const target = ctx.isServer ? 'node14' : 'chrome85'
|
||||||
|
|
||||||
config.optimization.minimizer.push(new ESBuildMinifyPlugin())
|
config.optimization.minimizer.push(new ESBuildMinifyPlugin())
|
||||||
|
|
||||||
config.plugins.push(new ESBuildPlugin())
|
config.plugins.push(new ESBuildPlugin())
|
||||||
@ -25,7 +30,7 @@ export function esbuild (ctx: WebpackConfigContext) {
|
|||||||
},
|
},
|
||||||
options: {
|
options: {
|
||||||
loader: 'ts',
|
loader: 'ts',
|
||||||
target: 'es2015'
|
target
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -33,7 +38,7 @@ export function esbuild (ctx: WebpackConfigContext) {
|
|||||||
loader: 'esbuild-loader',
|
loader: 'esbuild-loader',
|
||||||
options: {
|
options: {
|
||||||
loader: 'tsx',
|
loader: 'tsx',
|
||||||
target: 'es2015'
|
target
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user