Log minification time

Summary: public

Add an activity to log minification time.

Reviewed By: vjeux

Differential Revision: D2604863

fb-gh-sync-id: cbdf0297f0611c87b589b87928af235f9ba81172
This commit is contained in:
Tadeu Zagallo 2015-11-03 01:19:15 -08:00 committed by facebook-github-bot-4
parent 0caa2c64a1
commit 441995fa6a
1 changed files with 3 additions and 0 deletions

View File

@ -12,6 +12,7 @@ const _ = require('underscore');
const base64VLQ = require('./base64-vlq');
const UglifyJS = require('uglify-js');
const ModuleTransport = require('../lib/ModuleTransport');
const Activity = require('../Activity');
const SOURCEMAPPING_URL = '\n\/\/@ sourceMappingURL=';
@ -128,11 +129,13 @@ class Bundle {
const source = this._getSource();
try {
const minifyActivity = Activity.startEvent('minify');
this._minifiedSourceAndMap = UglifyJS.minify(source, {
fromString: true,
outSourceMap: 'bundle.js',
inSourceMap: this.getSourceMap(),
});
Activity.endEvent(minifyActivity);
return this._minifiedSourceAndMap;
} catch(e) {
// Sometimes, when somebody is using a new syntax feature that we