callstack / callstack/super-app-example

How to loading bundles from cdn?

オープン
#10 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
question
主要言語
Java
スター
40
フォーク
23
PR マージ指標
30日以内にマージされた PR はありません

説明

## 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!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

host-app/index.js の bundle コマンドと resolver から始め、次に CDN URL と動作する localhost resolver を比較します。host-app/src/screens/MiniAppScreen.js からの読み込みを再現し、生成された MiniApp.container.bundle に jsDelivr からアクセスでき、利用可能かどうかを確認します。MiniApp が CDN から読み込まれれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
javascript, react-native, webpack
領域
build-system, mobile
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。