callstack / callstack/super-app-example

How to loading bundles from cdn?

Offen
#10 0 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
question
Vorherrschende Sprache
Java
Sterne
40
Forks
23
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

## Ask your Question
I followed your example, everything runs fine on localhost, but when I want to load bundle from cdn, it doesn't seem to work.
- I generated bundle by running command: `react-native webpack-bundle --entry-file=index.js --dev=false --platform='ios' --bundle-output ios/MiniApp.container.bundle`
- Bundle cdn: `https://cdn.jsdelivr.net/gh/tungnt93/test_bundle/MiniApp.container.bundle`
- host-app/index.js:
```
ScriptManager.shared.addResolver(async (scriptId, caller) => {
const resolveURL = Federated.createURLResolver({
containers: {
MiniApp: "https://cdn.jsdelivr.net/gh/tungnt93/test_bundle/[name][ext]"
},
});

const url = resolveURL(scriptId, caller);
if (url) {
return {
url,
query: {
platform: Platform.OS,
},
};
}
});
```
If i change containers to localhost, everything runs fine
```
const resolveURL = Federated.createURLResolver({
containers: {
MiniApp: "http://localhost:9000/[name][ext]"
},
});
```
This is the image of host-app/src/screens/MiniAppScreen.js when i load from cdn: [https://i.imgur.com/cX3B1Ut.png](url)
So I want to ask, is my bundle generating command correct? If so, does uploading it to jsdelivr work, or do i have to upload it to another cdn?
Thank you!

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.