diff --git a/react-packager/src/ModuleGraph/worker/__tests__/optimize-module-test.js b/react-packager/src/ModuleGraph/worker/__tests__/optimize-module-test.js index d399360d..8494b014 100644 --- a/react-packager/src/ModuleGraph/worker/__tests__/optimize-module-test.js +++ b/react-packager/src/ModuleGraph/worker/__tests__/optimize-module-test.js @@ -54,7 +54,7 @@ describe('optimizing JS modules', () => { const result = optimizeModule(transformResult, optimizationOptions); optimized = result.transformed.default; injectedVars = optimized.code.match(/function\(([^)]*)/)[1].split(','); - [requireName,,,, dependencyMapName] = injectedVars; + [,requireName,,, dependencyMapName] = injectedVars; }); it('optimizes code', () => { diff --git a/react-packager/src/ModuleGraph/worker/__tests__/transform-module-test.js b/react-packager/src/ModuleGraph/worker/__tests__/transform-module-test.js index afdf4346..6c912822 100644 --- a/react-packager/src/ModuleGraph/worker/__tests__/transform-module-test.js +++ b/react-packager/src/ModuleGraph/worker/__tests__/transform-module-test.js @@ -105,7 +105,7 @@ describe('transforming JS modules:', () => { const {code, dependencyMapName} = result.transformed.default; expect(code.replace(/\s+/g, '')) .toEqual( - `__d(function(require,module,global,exports,${ + `__d(function(global,require,module,exports,${ dependencyMapName}){${transformedCode}});` ); done(); @@ -159,12 +159,12 @@ describe('transforming JS modules:', () => { const {dev, prod} = result.transformed; expect(dev.code.replace(/\s+/g, '')) .toEqual( - `__d(function(require,module,global,exports,${ + `__d(function(global,require,module,exports,${ dev.dependencyMapName}){arbitrary(code);});` ); expect(prod.code.replace(/\s+/g, '')) .toEqual( - `__d(function(require,module,global,exports,${ + `__d(function(global,require,module,exports,${ prod.dependencyMapName}){arbitrary(code);});` ); done(); @@ -178,7 +178,7 @@ describe('transforming JS modules:', () => { const {code} = result.transformed.default; expect(code.replace(/\s+/g, '')) .toEqual( - '__d(function(require,module,global,exports){' + + '__d(function(global,require,module,exports){' + `module.exports=${json}});` ); done(); diff --git a/react-packager/src/ModuleGraph/worker/transform-module.js b/react-packager/src/ModuleGraph/worker/transform-module.js index 4d6f3532..bc079b0f 100644 --- a/react-packager/src/ModuleGraph/worker/transform-module.js +++ b/react-packager/src/ModuleGraph/worker/transform-module.js @@ -35,7 +35,7 @@ export type TransformOptions = {| |}; const defaultVariants = {default: {}}; -const moduleFactoryParameters = ['require', 'module', 'global', 'exports']; +const moduleFactoryParameters = ['global', 'require', 'module', 'exports']; const polyfillFactoryParameters = ['global']; function transformModule(