Add 'inline' to UglifyJS source map content (#45904)

This commit is contained in:
Yuxuan Xie 2020-07-05 21:38:33 -07:00 committed by GitHub
parent 491f394a3e
commit f25da746d2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 7 deletions

View File

@ -433,7 +433,7 @@ export interface SourceMapOptions {
names?: boolean;
url?: string | 'inline';
root?: string;
content?: RawSourceMap;
content?: RawSourceMap | 'inline';
}
export function minify(files: string | string[] | { [file: string]: string }, options?: MinifyOptions): MinifyOutput;

View File

@ -11,7 +11,7 @@ code = {
minify(code);
code = "function add(first, second) { return first + second; }";
code = 'function add(first, second) { return first + second; }';
minify(code, { toplevel: true });
minify(code, {
@ -27,7 +27,7 @@ const output = minify(code, {
warnings: 'verbose',
mangle: {
properties: {
regex: /reg/
regex: /reg/,
},
toplevel: true,
},
@ -38,12 +38,15 @@ const output = minify(code, {
compress: {
arguments: true,
global_defs: {
"@console.log": "alert"
'@console.log': 'alert',
},
passes: 2,
},
nameCache: {},
});
if (output.warnings) {
output.warnings.filter(x => x === 'Dropping unused variable');
}
const compressOptions = {
booleans: true,
@ -63,6 +66,8 @@ minify(code, {
compress: compressOptions,
});
if (output.warnings) {
output.warnings.filter(x => x === 'Dropping unused variable');
}
minify(code, {
sourceMap: {
content: 'inline',
},
});