Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix multiple entries pointing to wrong bundle in dist #8991

Merged
merged 8 commits into from
May 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/core/core/src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const base62 = baseX(
);

export function getBundleGroupId(bundleGroup: BundleGroup): string {
return 'bundle_group:' + bundleGroup.entryAssetId;
return 'bundle_group:' + bundleGroup.target.name + bundleGroup.entryAssetId;
}

export function assertSignalNotAborted(signal: ?AbortSignal): void {
Expand Down
53 changes: 53 additions & 0 deletions packages/core/integration-tests/test/html.js
Original file line number Diff line number Diff line change
Expand Up @@ -2076,6 +2076,59 @@ describe('html', function () {
}
});

it('supports multiple dist targets', async function () {
let b = await bundle(
path.join(__dirname, '/integration/html-multi-targets/'),
{
mode: 'production',
defaultTargetOptions: {
shouldScopeHoist: false,
shouldOptimize: false,
sourceMaps: false,
},
},
);
assertBundles(b, [
{
name: 'index.html',
type: 'html',
assets: ['index.html'],
},
{
type: 'js',
assets: [
'bundle-manifest.js',
'bundle-url.js',
'cacheLoader.js',
'index.js',
'js-loader.js',
],
},
{
type: 'js',
assets: ['esmodule-helpers.js', 'shared.js'],
},
{
type: 'js',
assets: ['esmodule-helpers.js', 'shared.js'],
},
{
name: 'index.html',
type: 'html',
assets: ['index.html'],
},
{
type: 'js',
assets: [
'bundle-manifest.js',
'bundle-url.js',
'cacheLoader.js',
'index.js',
'js-loader.js',
],
},
]);
});
it('should isolate async scripts', async function () {
let b = await bundle(
path.join(__dirname, '/integration/html-async-script/index.html'),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "assets-in-confluence",
"version": "0.1.0",
"private": true,
"targets": {
"main1": {
"distDir": "./dist/main1",
"source": "./src/main1/index.html",
"publicUrl": "./"
},
"main2": {
"distDir": "./dist/main2",
"source": "./src/main2/index.html",
"publicUrl": "./"
}
},
"@parcel/bundler-default": {
"minBundleSize": 0
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script type="module" src="index.js"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = async function () {
return import('../shared');
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<script type="module" src="index.js"></script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = async function () {
return import('../shared');
};
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export const stuff = () => 'lots and lots of stuff'