From cbeb9f2d7859edbaceee0c73d2b33c578a1ffb58 Mon Sep 17 00:00:00 2001 From: Evan You Date: Tue, 17 May 2022 10:50:40 +0800 Subject: [PATCH] build: output es2020 (target node 14+) for cjs/server builds --- rollup.config.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rollup.config.js b/rollup.config.js index 6e909274..16f6a465 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -84,6 +84,7 @@ function createConfig(format, output, plugins = []) { process.env.__DEV__ === 'false' || /\.prod\.js$/.test(output.file) const isBundlerESMBuild = /esm-bundler/.test(format) const isBrowserESMBuild = /esm-browser/.test(format) + const isServerRenderer = name === 'server-renderer' const isNodeBuild = format === 'cjs' const isGlobalBuild = /global/.test(format) const isCompatPackage = pkg.name === '@vue/compat' @@ -106,6 +107,7 @@ function createConfig(format, output, plugins = []) { cacheRoot: path.resolve(__dirname, 'node_modules/.rts2_cache'), tsconfigOverride: { compilerOptions: { + target: isServerRenderer || isNodeBuild ? 'es2020' : 'es2015', sourceMap: output.sourcemap, declaration: shouldEmitDeclarations, declarationMap: shouldEmitDeclarations