mirror of
https://github.com/status-im/react-native.git
synced 2025-01-29 02:35:41 +00:00
0b46a0c13b
Summary: public RFC: The minifier haven't been stripping dead-code, and it also can't kill unused modules, so as a temporary solution this inlines `__DEV__`, kill dead branches and kill dead modules. For now I'm just white-listing the dev variable, but we could definitely do better than that, but as a temporary fix this should be helpful. I also intend to kill some dead variables, so we can kill unused requires, although inline-requires can also fix it. Reviewed By: vjeux Differential Revision: D2605454 fb-gh-sync-id: 50acb9dcbded07a43080b93ac826a5ceda695936
30 lines
742 B
JavaScript
30 lines
742 B
JavaScript
/**
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*/
|
|
'use strict';
|
|
|
|
const log = require('../util/log').out('bundle');
|
|
|
|
function processBundle(input, dev) {
|
|
log('start');
|
|
let bundle;
|
|
if (!dev) {
|
|
bundle = input.getMinifiedSourceAndMap(dev);
|
|
} else {
|
|
bundle = {
|
|
code: input.getSource({ dev }),
|
|
map: JSON.stringify(input.getSourceMap({ dev })),
|
|
};
|
|
}
|
|
bundle.assets = input.getAssets();
|
|
log('finish');
|
|
return bundle;
|
|
}
|
|
|
|
module.exports = processBundle;
|