mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix release / minified bundle builds
Summary: Fixes building release builds with the new buck integration. Reviewed By: jeanlauliac Differential Revision: D5002441 fbshipit-source-id: e7716324c7c8dd0bfcaf5b39cf716ac589e948e8
This commit is contained in:
committed by
Facebook Github Bot
parent
11eef69936
commit
1a0e78c4e4
@@ -36,23 +36,24 @@ describe('optimizing JS modules', () => {
|
||||
if (error) {
|
||||
throw error;
|
||||
}
|
||||
transformResult = JSON.stringify(result.details);
|
||||
transformResult = JSON.stringify({type: 'code', details: result.details});
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
it('copies everything from the transformed file, except for transform results', () => {
|
||||
const result = optimizeModule(transformResult, optimizationOptions);
|
||||
const expected = JSON.parse(transformResult);
|
||||
const expected = JSON.parse(transformResult).details;
|
||||
delete expected.transformed;
|
||||
expect(result).toEqual(objectContaining(expected));
|
||||
expect(result.type).toBe('code');
|
||||
expect(result.details).toEqual(objectContaining(expected));
|
||||
});
|
||||
|
||||
describe('code optimization', () => {
|
||||
let dependencyMapName, injectedVars, optimized, requireName;
|
||||
beforeAll(() => {
|
||||
const result = optimizeModule(transformResult, optimizationOptions);
|
||||
optimized = result.transformed.default;
|
||||
optimized = result.details.transformed.default;
|
||||
injectedVars = optimized.code.match(/function\(([^)]*)/)[1].split(',');
|
||||
[, requireName,,, dependencyMapName] = injectedVars;
|
||||
});
|
||||
@@ -79,10 +80,16 @@ describe('optimizing JS modules', () => {
|
||||
const result = optimizeModule(
|
||||
transformResult,
|
||||
{...optimizationOptions, isPolyfill: true},
|
||||
);
|
||||
).details;
|
||||
expect(result.transformed.default.dependencies).toEqual([]);
|
||||
});
|
||||
});
|
||||
|
||||
it('passes through non-code data unmodified', () => {
|
||||
const data = {type: 'asset', details: {arbitrary: 'data'}};
|
||||
expect(optimizeModule(JSON.stringify(data), {dev: true, platform: ''}))
|
||||
.toEqual(data);
|
||||
});
|
||||
});
|
||||
|
||||
function findLast(code, needle) {
|
||||
|
||||
Reference in New Issue
Block a user