mirror of https://github.com/status-im/metro.git
[RectNative][Packager] Cache minification result
Summary: The packager just cached the result of the bundle, but would minify it on every request. Change it to cache the minification result.
This commit is contained in:
parent
734edf5cd4
commit
79abdb2250
|
@ -115,13 +115,18 @@ class Bundle {
|
||||||
getMinifiedSourceAndMap() {
|
getMinifiedSourceAndMap() {
|
||||||
this._assertFinalized();
|
this._assertFinalized();
|
||||||
|
|
||||||
|
if (this._minifiedSourceAndMap) {
|
||||||
|
return this._minifiedSourceAndMap;
|
||||||
|
}
|
||||||
|
|
||||||
const source = this._getSource();
|
const source = this._getSource();
|
||||||
try {
|
try {
|
||||||
return UglifyJS.minify(source, {
|
this._minifiedSourceAndMap = UglifyJS.minify(source, {
|
||||||
fromString: true,
|
fromString: true,
|
||||||
outSourceMap: 'bundle.js',
|
outSourceMap: 'bundle.js',
|
||||||
inSourceMap: this.getSourceMap(),
|
inSourceMap: this.getSourceMap(),
|
||||||
});
|
});
|
||||||
|
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
|
||||||
// don't yet have transform for, the untransformed line is sent to
|
// don't yet have transform for, the untransformed line is sent to
|
||||||
|
|
Loading…
Reference in New Issue