diff --git a/react-packager/src/Packager/Package.js b/react-packager/src/Packager/Package.js index c621f747..eca709d5 100644 --- a/react-packager/src/Packager/Package.js +++ b/react-packager/src/Packager/Package.js @@ -285,6 +285,6 @@ function generateSourceMapForVirtualModule(module) { names: [], mappings: mappings, file: module.sourcePath, - sourcesContent: [ module.code ], + sourcesContent: [ module.sourceCode ], }; } diff --git a/react-packager/src/Packager/__tests__/Packager-test.js b/react-packager/src/Packager/__tests__/Packager-test.js index 9babda54..901c467b 100644 --- a/react-packager/src/Packager/__tests__/Packager-test.js +++ b/react-packager/src/Packager/__tests__/Packager-test.js @@ -150,7 +150,9 @@ describe('Packager', function() { sourceCode: 'module.exports = ' + JSON.stringify(imgModule_DEPRECATED) + ';', - sourcePath: '/root/img/img.png' + sourcePath: '/root/img/img.png', + virtual: true, + map: undefined, }); var imgModule = { @@ -172,13 +174,17 @@ describe('Packager', function() { sourceCode: 'module.exports = require("AssetRegistry").registerAsset(' + JSON.stringify(imgModule) + ');', - sourcePath: '/root/img/new_image.png' + sourcePath: '/root/img/new_image.png', + virtual: true, + map: undefined, }); expect(p.addModule.mock.calls[4][0]).toEqual({ code: 'lol module.exports = {"json":true}; lol', sourceCode: 'module.exports = {"json":true};', - sourcePath: '/root/file.json' + sourcePath: '/root/file.json', + map: undefined, + virtual: true, }); expect(p.finalize.mock.calls[0]).toEqual([ diff --git a/react-packager/src/Packager/index.js b/react-packager/src/Packager/index.js index e647f764..e5afefe7 100644 --- a/react-packager/src/Packager/index.js +++ b/react-packager/src/Packager/index.js @@ -165,6 +165,7 @@ Packager.prototype._transformModule = function(ppackage, module) { map: transformed.map, sourceCode: transformed.sourceCode, sourcePath: transformed.sourcePath, + virtual: transformed.virtual, }); }); };