mirror of
https://github.com/status-im/metro.git
synced 2025-01-17 14:41:09 +00:00
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:
parent
02c3c465f8
commit
a0dd08e26c
3
react-packager/src/Bundler/Bundle.js
vendored
3
react-packager/src/Bundler/Bundle.js
vendored
@ -12,6 +12,7 @@ const _ = require('underscore');
|
|||||||
const base64VLQ = require('./base64-vlq');
|
const base64VLQ = require('./base64-vlq');
|
||||||
const UglifyJS = require('uglify-js');
|
const UglifyJS = require('uglify-js');
|
||||||
const ModuleTransport = require('../lib/ModuleTransport');
|
const ModuleTransport = require('../lib/ModuleTransport');
|
||||||
|
const Activity = require('../Activity');
|
||||||
|
|
||||||
const SOURCEMAPPING_URL = '\n\/\/@ sourceMappingURL=';
|
const SOURCEMAPPING_URL = '\n\/\/@ sourceMappingURL=';
|
||||||
|
|
||||||
@ -128,11 +129,13 @@ class Bundle {
|
|||||||
|
|
||||||
const source = this._getSource();
|
const source = this._getSource();
|
||||||
try {
|
try {
|
||||||
|
const minifyActivity = Activity.startEvent('minify');
|
||||||
this._minifiedSourceAndMap = UglifyJS.minify(source, {
|
this._minifiedSourceAndMap = UglifyJS.minify(source, {
|
||||||
fromString: true,
|
fromString: true,
|
||||||
outSourceMap: 'bundle.js',
|
outSourceMap: 'bundle.js',
|
||||||
inSourceMap: this.getSourceMap(),
|
inSourceMap: this.getSourceMap(),
|
||||||
});
|
});
|
||||||
|
Activity.endEvent(minifyActivity);
|
||||||
return this._minifiedSourceAndMap;
|
return this._minifiedSourceAndMap;
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
// Sometimes, when somebody is using a new syntax feature that we
|
// Sometimes, when somebody is using a new syntax feature that we
|
||||||
|
Loading…
x
Reference in New Issue
Block a user