diff --git a/react-packager/src/Bundler/index.js b/react-packager/src/Bundler/index.js index d2053fa1..8ee861d2 100644 --- a/react-packager/src/Bundler/index.js +++ b/react-packager/src/Bundler/index.js @@ -530,12 +530,14 @@ class Bundler { _toModuleTransport({module, bundle, entryFilePath, transformOptions, getModuleId}) { let moduleTransport; + const moduleId = getModuleId(module); + if (module.isAsset_DEPRECATED()) { moduleTransport = - this._generateAssetModule_DEPRECATED(bundle, module, getModuleId); + this._generateAssetModule_DEPRECATED(bundle, module, moduleId); } else if (module.isAsset()) { moduleTransport = this._generateAssetModule( - bundle, module, getModuleId, transformOptions.platform); + bundle, module, moduleId, transformOptions.platform); } if (moduleTransport) { @@ -556,7 +558,7 @@ class Bundler { return new ModuleTransport({ name, - id: getModuleId(module), + id: moduleId, code, map, meta: {dependencies, dependencyOffsets, preloaded}, @@ -566,7 +568,7 @@ class Bundler { }); } - _generateAssetModule_DEPRECATED(bundle, module, getModuleId) { + _generateAssetModule_DEPRECATED(bundle, module, moduleId) { return Promise.all([ sizeOf(module.path), module.getName(), @@ -586,7 +588,7 @@ class Bundler { return new ModuleTransport({ name: id, - id: getModuleId(module), + id: moduleId, code: code, sourceCode: code, sourcePath: module.path, @@ -645,7 +647,7 @@ class Bundler { } - _generateAssetModule(bundle, module, getModuleId, platform = null) { + _generateAssetModule(bundle, module, moduleId, platform = null) { return Promise.all([ module.getName(), this._generateAssetObjAndCode(module, platform), @@ -653,7 +655,7 @@ class Bundler { bundle.addAsset(asset); return new ModuleTransport({ name, - id: getModuleId(module), + id: moduleId, code, meta: meta, sourceCode: code,