diff --git a/packages/core/core/src/PackagerRunner.js b/packages/core/core/src/PackagerRunner.js index 35ad6f35c75b..61715a7b2130 100644 --- a/packages/core/core/src/PackagerRunner.js +++ b/packages/core/core/src/PackagerRunner.js @@ -460,7 +460,14 @@ export default class PackagerRunner { }; let mapKey = cacheKeys.map; - if (await this.options.cache.blobExists(mapKey)) { + if ( + (bundle.target.sourceMap + ? typeof bundle.target.sourceMap === 'object' + ? !bundle.target.sourceMap.inline + : bundle.target.sourceMap + : true) && + (await this.options.cache.blobExists(mapKey)) + ) { let mapStream = this.options.cache.getStream(mapKey); await writeFileStream( outputFS, diff --git a/packages/packagers/js/src/JSPackager.js b/packages/packagers/js/src/JSPackager.js index 1b14b014e47e..fa0744535737 100644 --- a/packages/packagers/js/src/JSPackager.js +++ b/packages/packagers/js/src/JSPackager.js @@ -84,7 +84,7 @@ export default new Packager({ queue.add(async () => { let [code, mapBuffer] = await Promise.all([ node.value.getCode(), - node.value.getMapBuffer(), + bundle.target.sourceMap && node.value.getMapBuffer(), ]); return {code, mapBuffer}; });