Skip to content

Commit

Permalink
feat: use metro for web bundling in js library template (#574)
Browse files Browse the repository at this point in the history
### Summary

This changes the bundler to Metro for the example app using Expo. It
reduces the configuration required and aligns with the new defaults of
Expo projects.

### Test plan

- Create a library and choose the "JavaScript library" example
- Ensure that the project runs on the web

<img width="995" alt="image"
src="https://github.com/callstack/react-native-builder-bob/assets/1174278/8dbe93dd-730f-49cd-9147-a7ec6f56e140">
satya164 authored Jul 1, 2024
1 parent f17ee89 commit 6422571
Showing 4 changed files with 3 additions and 36 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-templates.yml
Original file line number Diff line number Diff line change
@@ -183,7 +183,7 @@ jobs:
working-directory: ${{ env.work_dir }}
if: matrix.language == 'js'
run: |
yarn example expo export:web
yarn example expo export --platform web
- name: Install JDK
if: env.android_build == 1 && env.turbo_cache_hit_android != 1
Original file line number Diff line number Diff line change
@@ -38,15 +38,11 @@ const PACKAGES_TO_ADD_DEV = {
};

const PACKAGES_TO_ADD_WEB = {
'@expo/metro-runtime': '~3.2.1',
'react-dom': '18.2.0',
'react-native-web': '~0.18.10',
};

const PACKAGES_TO_ADD_WEB_DEV = {
'@expo/webpack-config': '^18.0.1',
'babel-loader': '^8.1.0',
};

export default async function generateExampleApp({
type,
dest,
@@ -161,10 +157,6 @@ export default async function generateExampleApp({
dependencies[name] = bundledNativeModules[name] || version;
});

Object.entries(PACKAGES_TO_ADD_WEB_DEV).forEach(([name, version]) => {
devDependencies[name] = bundledNativeModules[name] || version;
});

scripts.web = 'expo start --web';
}

Original file line number Diff line number Diff line change
@@ -168,5 +168,5 @@ jobs:

- name: Build example for Web
run: |
yarn example expo export:web
yarn example expo export --platform web
<% } -%>

This file was deleted.

0 comments on commit 6422571

Please sign in to comment.