feat(vite): allow setting of build target (#16588)

This commit is contained in:
Katerina Skroumpelou 2023-04-26 15:26:26 -05:00 committed by GitHub
parent cab7aacc55
commit 44654251bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 1 deletions

View File

@ -58,6 +58,10 @@
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.", "description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"oneOf": [{ "type": "boolean" }, { "type": "string" }] "oneOf": [{ "type": "boolean" }, { "type": "string" }]
}, },
"target": {
"description": "Browser compatibility target for the final bundle. For more info: https://vitejs.dev/config/build-options.html#build-target",
"type": "string"
},
"minify": { "minify": {
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.", "description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"oneOf": [{ "type": "boolean" }, { "type": "string" }] "oneOf": [{ "type": "boolean" }, { "type": "string" }]

View File

@ -14,4 +14,5 @@ export interface ViteBuildExecutorOptions {
mode?: string; mode?: string;
ssr?: boolean | string; ssr?: boolean | string;
watch?: object | boolean; watch?: object | boolean;
target?: string | string[];
} }

View File

@ -67,6 +67,10 @@
} }
] ]
}, },
"target": {
"description": "Browser compatibility target for the final bundle. For more info: https://vitejs.dev/config/build-options.html#build-target",
"type": "string"
},
"minify": { "minify": {
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.", "description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
"oneOf": [ "oneOf": [

View File

@ -139,7 +139,7 @@ export function getViteBuildOptions(
emptyOutDir: options.emptyOutDir, emptyOutDir: options.emptyOutDir,
reportCompressedSize: true, reportCompressedSize: true,
cssCodeSplit: true, cssCodeSplit: true,
target: 'esnext', target: options.target ?? 'esnext',
commonjsOptions: { commonjsOptions: {
transformMixedEsModules: true, transformMixedEsModules: true,
}, },