Skip to content

Commit

Permalink
Don't emit runtime manifest for inline child bundles (#6807)
Browse files Browse the repository at this point in the history
* Add test

* Fix

* Remove debug code
  • Loading branch information
mischnic authored Aug 30, 2021
1 parent 461de11 commit 68aba46
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 1 deletion.
42 changes: 42 additions & 0 deletions packages/core/integration-tests/test/javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -4053,6 +4053,48 @@ describe('javascript', function() {
background-color: #000000;
}
.svg-img {
background-image: url("data:image/svg+xml,%3Csvg%3E%0A%0A%3C%2Fsvg%3E%0A");
}`,
),
);

assert(!cssBundleContent.includes('sourceMappingURL'));
});

it('should not include the runtime manifest for `bundle-text`', async () => {
let b = await bundle(
path.join(__dirname, '/integration/bundle-text/index.js'),
{
mode: 'production',
defaultTargetOptions: {shouldScopeHoist: false, shouldOptimize: false},
},
);

assertBundles(b, [
{
name: 'index.js',
type: 'js',
assets: ['esmodule-helpers.js', 'index.js'],
},
{
type: 'svg',
assets: ['img.svg'],
},
{
type: 'css',
assets: ['text.scss'],
},
]);

let cssBundleContent = (await run(b)).default;

assert(
cssBundleContent.startsWith(
`body {
background-color: #000000;
}
.svg-img {
background-image: url("data:image/svg+xml,%3Csvg%3E%0A%0A%3C%2Fsvg%3E%0A");
}`,
Expand Down
4 changes: 3 additions & 1 deletion packages/runtimes/js/src/JSRuntime.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,9 @@ export default (new Runtime({

if (
shouldUseRuntimeManifest(bundle, options) &&
bundleGraph.getChildBundles(bundle).length > 0 &&
bundleGraph
.getChildBundles(bundle)
.some(b => b.bundleBehavior !== 'inline') &&
isNewContext(bundle, bundleGraph)
) {
assets.push({
Expand Down

0 comments on commit 68aba46

Please sign in to comment.