Skip to content

Commit

Permalink
node 6 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
DeMoorJasper committed Feb 20, 2018
1 parent 0a4db4d commit 5d3b8b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/transforms/uglify.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,26 @@ module.exports = async function(asset) {
options = Object.assign(options, customConfig);
}

let {code, map, error} = minify(source, options);
let result = minify(source, options);

if (error) {
throw error;
if (result.error) {
throw result.error;
}

if (map) {
map = await new SourceMap().addMap(JSON.parse(map));
if (result.map) {
result.map = await new SourceMap().addMap(JSON.parse(result.map));
if (asset.sourceMap) {
asset.sourceMap = await new SourceMap().extendSourceMap(
asset.sourceMap,
map
result.map
);
} else {
asset.sourceMap = map;
asset.sourceMap = result.map;
}
}

// babel-generator did our code generation for us, so remove the old AST
asset.ast = null;
asset.outputCode = code;
asset.outputCode = result.code;
asset.isAstDirty = false;
};

0 comments on commit 5d3b8b0

Please sign in to comment.