callstack / callstack/super-app-example
How to loading bundles from cdn?
- Ngôn ngữ chính
- Java
- Star
- 40
- Fork
- 23
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Mô tả
## 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!
Hướng dẫn đóng góp
Hướng nghiên cứu
Bắt đầu với lệnh bundle và resolver trong host-app/index.js, sau đó so sánh URL CDN với resolver localhost đang hoạt động. Tái hiện việc tải từ host-app/src/screens/MiniAppScreen.js và xác minh liệu MiniApp.container.bundle được tạo ra có thể truy cập và sử dụng từ jsDelivr hay không; hoàn thành khi MiniApp được tải từ CDN.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- javascript, react-native, webpack
- Lĩnh vực
- build-system, mobile
- Loại issue
- Lỗi
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100