Skip to content

Commit

Permalink
Make sure to set unique key (fix) (#9326)
Browse files Browse the repository at this point in the history
* forgot to readd in uniquekey

* add tests
  • Loading branch information
AGawrys authored Oct 18, 2023
1 parent 060561e commit bb7ff69
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/bundlers/default/src/DefaultBundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,7 @@ function createIdealGraph(
manualSharedMap.set(manualSharedBundleKey, bundleId);
}
bundle.manualSharedBundle = manualSharedObject.name;
bundle.uniqueKey = manualSharedObject.name + childAsset.type;
}
}
}
Expand Down
9 changes: 9 additions & 0 deletions packages/core/integration-tests/test/bundler.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
fsFixture,
run,
} from '@parcel/test-utils';
import {hashString} from '@parcel/rust';

describe('bundler', function () {
it('should not create shared bundles when a bundle is being reused and disableSharedBundles is enabled', async function () {
Expand Down Expand Up @@ -1520,6 +1521,10 @@ describe('bundler', function () {
assets: ['math.js', 'add.js', 'subtract.js'],
},
]);

let targetDistDir = __dirname.replace('/test', '/dist');
let hashedIdWithMSB = hashString('bundle:' + 'vendorjs' + targetDistDir);
assert(b.getBundles().find(b => b.id == hashedIdWithMSB));
});

it('should support manual shared bundles with constants module', async function () {
Expand Down Expand Up @@ -1655,6 +1660,10 @@ describe('bundler', function () {
},
]);

let targetDistDir = __dirname.replace('/test', '/dist');
let hashedIdWithMSB = hashString('bundle:' + 'vendorjs' + targetDistDir);
assert(b.getBundles().find(b => b.id == hashedIdWithMSB));

await run(b);
});

Expand Down

0 comments on commit bb7ff69

Please sign in to comment.