feat: add option.outFileName for JS API, if absense, sourceMap.file field will deduced
This commit is contained in:
committed by
Richard van Velzen
parent
2a9989dd18
commit
0a35acbbe7
@@ -41,6 +41,7 @@ exports.minify = function(files, options) {
|
||||
options = UglifyJS.defaults(options, {
|
||||
spidermonkey : false,
|
||||
outSourceMap : null,
|
||||
outFileName : null,
|
||||
sourceRoot : null,
|
||||
inSourceMap : null,
|
||||
sourceMapUrl : null,
|
||||
@@ -120,7 +121,8 @@ exports.minify = function(files, options) {
|
||||
}
|
||||
if (options.outSourceMap || options.sourceMapInline) {
|
||||
output.source_map = UglifyJS.SourceMap({
|
||||
file: options.outSourceMap,
|
||||
// prefer outFileName, otherwise use outSourceMap without .map suffix
|
||||
file: options.outFileName || (typeof options.outSourceMap === 'string' ? options.outSourceMap.replace(/\.map$/i, '') : null),
|
||||
orig: inMap,
|
||||
root: options.sourceRoot
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user