diff --git a/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap b/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap index 739b420e..643a6feb 100644 --- a/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap +++ b/packages/metro-bundler/src/integration_tests/__tests__/__snapshots__/basic_bundle-test.js.snap @@ -1,6 +1,6 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`basic_bundle bundles package with polyfills as expected 1`] = ` +exports[`basic_bundle bundles package with polyfills 1`] = ` "(function(global) { global.__DEV__ = false; @@ -267,7 +267,7 @@ __d(/* /AssetRegistry.js */function(global, require, module, exports) { ;require(0);" `; -exports[`basic_bundle bundles package without polyfills as expected 1`] = ` +exports[`basic_bundle bundles package without polyfills 1`] = ` "(function(global) { global.__DEV__ = false; @@ -484,28 +484,12 @@ if (__DEV__) { })(); } })(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this); -(function(global) { - -'use strict'; - -if (!Object.keys) { - Object.keys = function () {}; -} -})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this); -(function(global) { - -'use strict'; - -if (!String.prototype.repeat) { - String.prototype.repeat = function () {}; -} -})(typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : this); __d(/* /TestBundle.js */function(global, require, module, exports) { 'use strict'; -var Bar = require(5); // 5 = ./Bar -var Foo = require(6); // 6 = ./Foo +var Bar = require(3); // 3 = ./Bar +var Foo = require(4); // 4 = ./Foo module.exports = { Foo: Foo, Bar: Bar }; }, 0); @@ -513,23 +497,23 @@ __d(/* /Bar.js */function(global, require, module, exports) { 'use strict'; -var Foo = require(6); // 6 = ./Foo +var Foo = require(4); // 4 = ./Foo module.exports = { type: 'bar', foo: Foo.type }; -}, 5); +}, 3); __d(/* /Foo.js */function(global, require, module, exports) { 'use strict'; -var asset = require(7); // 7 = ./test.png +var asset = require(5); // 5 = ./test.png module.exports = { type: 'foo', asset: asset }; -}, 6); -__d(/* /test.png */function(global, require, module, exports) {module.exports=require(8).registerAsset({\\"__packager_asset\\":true,\\"httpServerLocation\\":\\"/assets\\",\\"width\\":8,\\"height\\":8,\\"scales\\":[1],\\"hash\\":\\"77d45c1f7fa73c0f6c444a830dc42f67\\",\\"name\\":\\"test\\",\\"type\\":\\"png\\"}); // 8 = /AssetRegistry -}, 7); +}, 4); +__d(/* /test.png */function(global, require, module, exports) {module.exports=require(6).registerAsset({\\"__packager_asset\\":true,\\"httpServerLocation\\":\\"/assets\\",\\"width\\":8,\\"height\\":8,\\"scales\\":[1],\\"hash\\":\\"77d45c1f7fa73c0f6c444a830dc42f67\\",\\"name\\":\\"test\\",\\"type\\":\\"png\\"}); // 6 = /AssetRegistry +}, 5); __d(/* /AssetRegistry.js */function(global, require, module, exports) { 'use strict'; -}, 8); +}, 6); ;require(0);" `; diff --git a/packages/metro-bundler/src/integration_tests/__tests__/basic_bundle-test.js b/packages/metro-bundler/src/integration_tests/__tests__/basic_bundle-test.js index 43b0b6d8..d6091b4e 100644 --- a/packages/metro-bundler/src/integration_tests/__tests__/basic_bundle-test.js +++ b/packages/metro-bundler/src/integration_tests/__tests__/basic_bundle-test.js @@ -92,7 +92,7 @@ describe('basic_bundle', () => { ).toMatchSnapshot(); } - it('bundles package with polyfills as expected', async () => { + it('bundles package with polyfills', async () => { const bundleWithPolyfills = await Packager.buildBundle( { assetRegistryPath: ASSET_REGISTRY_PATH, @@ -111,11 +111,11 @@ describe('basic_bundle', () => { verifyResultCode(bundleWithPolyfills.getSource()); }); - it('bundles package without polyfills as expected', async () => { + it('bundles package without polyfills', async () => { const bundleWithoutPolyfills = await Packager.buildBundle( { assetRegistryPath: ASSET_REGISTRY_PATH, - getPolyfills: () => [polyfill1, polyfill2], + getPolyfills: () => [], projectRoots: [INPUT_PATH, POLYFILLS_PATH], transformCache: Packager.TransformCaching.none(), transformModulePath: require.resolve('../../transformer'), diff --git a/packages/metro-bundler/src/node-haste/lib/toLocalPath.js b/packages/metro-bundler/src/node-haste/lib/toLocalPath.js index a4ea441b..e6f011aa 100644 --- a/packages/metro-bundler/src/node-haste/lib/toLocalPath.js +++ b/packages/metro-bundler/src/node-haste/lib/toLocalPath.js @@ -31,7 +31,7 @@ function toLocalPath( } throw new Error( - 'Expected root module to be relative to one of the project roots', + `Expected path \`${absolutePath}\` to be relative to one of the project roots`, ); }