Skip to content

Instantly share code, notes, and snippets.

@callstack-bot
Last active September 26, 2022 16:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save callstack-bot/22ac442379284e7acd1473965c38f579 to your computer and use it in GitHub Desktop.
Save callstack-bot/22ac442379284e7acd1473965c38f579 to your computer and use it in GitHub Desktop.
const resolveURL = Federated.createURLResolver({
containers: {
app1: 'http://localhost:9000/[name][ext]',
app2: 'http://localhost:9001/[name][ext]',
module1: 'http://localhost:9002/[name][ext]',
},
});
ScriptManager.shared.addResolver(async (scriptId, caller) => {
let url;
if (caller === 'main') {
url = Script.getDevServerURL(scriptId);
} else {
url = resolveURL(scriptId, caller);
}
if (!url) {
return undefined;
}
return {
url,
cache: false,
query: {
platform: Platform.OS,
},
};
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment