Skip to content

Commit bd58562

Browse files
authored
refactor: allow passing referenceUrl to prefetchScript (#1123)
* refactor: allow passing referenceUrl to prefetchScript * chore: changeset
1 parent 19c814f commit bd58562

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

.changeset/tasty-snails-lie.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@callstack/repack": patch
3+
---
4+
5+
Allow passing `referenceUrl` to `ScriptManager.prefetchScript`

packages/repack/src/modules/ScriptManager/ScriptManager.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -692,14 +692,20 @@ export class ScriptManager extends EventEmitter {
692692
async prefetchScript(
693693
scriptId: string,
694694
caller?: string,
695-
webpackContext = getWebpackContext()
695+
webpackContext = getWebpackContext(),
696+
referenceUrl?: string
696697
) {
697698
const uniqueId = Script.getScriptUniqueId(scriptId, caller);
698699
if (this.scriptsPromises[uniqueId]) {
699700
return this.scriptsPromises[uniqueId];
700701
}
701702
const loadProcess = async () => {
702-
const script = await this.resolveScript(scriptId, caller, webpackContext);
703+
const script = await this.resolveScript(
704+
scriptId,
705+
caller,
706+
webpackContext,
707+
referenceUrl
708+
);
703709

704710
try {
705711
this.emit('prefetching', script.toObject());

0 commit comments

Comments
 (0)