nx-labs
nx-labs copied to clipboard
[expo] How to use eas build?
In my expo app apps/dashboard
I have package.json:
{
"name": "dashboard",
"version": "0.0.1",
"private": true,
"dependencies": {
"expo": "",
"@expo/metro-config": "",
"@nrwl/expo": "",
"@testing-library/react-native": "",
"react": "",
"@react-native-async-storage/async-storage": "",
"axios": "",
"axios-auth-refresh": "",
"react-native-paper-dates": "",
"lodash": "",
"moment": "",
"@emotion/cache": "",
"@mobily/stacks": "",
"react-native-toast-notifications": "",
"react-native-paper": "",
"react-native": "",
"expo-clipboard": "",
"react-hook-form": "",
"@react-navigation/native-stack": "",
"react-content-loader": "",
"victory-native": "",
"@testing-library/jest-native": "",
"@hookform/resolvers": "",
"yup": "",
"expo-constants": "",
"file-saver": "",
"react-native-safe-area-context": "",
"@testing-library/react": "",
"@react-navigation/native": "",
"react-native-screens": "",
"@react-navigation/material-top-tabs": "",
"tsconfig-paths-webpack-plugin": "",
"@aws-sdk/client-s3": "",
"react-native-url-polyfill": "",
"react-native-get-random-values": "",
"react-dom": "",
"react-error-boundary": "",
"moti": "",
"expo-blur": "",
"@react-navigation/drawer": "",
"react-native-mask-text": "",
"expo-splash-screen": "",
"expo-status-bar": "",
"react-native-web": "",
"@formatjs/intl-getcanonicallocales": "",
"@formatjs/intl-locale": "",
"@formatjs/intl-pluralrules": "",
"@formatjs/intl-displaynames": "",
"@formatjs/intl-listformat": "",
"@formatjs/intl-numberformat": "",
"@formatjs/intl-relativetimeformat": "",
"@formatjs/intl-datetimeformat": "",
"expo-localization": "",
"expo-linking": "",
"payment": "",
"@faker-js/faker": "",
"@tanstack/react-query": "",
"@mui/material": "",
"@mui/lab": "",
"classnames": "",
"react-input-mask": "",
"@react-native-community/slider": "",
"react-native-tab-view": "",
"@expo-google-fonts/roboto": "",
"expo-app-loading": "",
"@mui/x-data-grid": "",
"@react-navigation/bottom-tabs": "",
"credit-card-type": ""
},
"scripts": {
"eas-build-pre-install": "cd ../../ && cp yarn.lock ./apps/dashboard/",
"postinstall": "rm -r node_modules && cd ../../ && yarn install && npx nx sync-deps dashboard && npx nx ensure-symlink dashboard"
},
"devDependencies": {
"@babel/core": "*"
}
}
When I yarn nx build dashboard --platform=all
I have error:
I should set @mui/lab
version or I can use another solution?
Did you run yarn install
at the root level first?
What I learned is that you basically need to:
- Run
yarn install
where the mainpackage.json
for your entire monorepo is. - Copy over any expo packages that you will need installed/linked inside of
apps/dashboard/package.json
as"packageName": "*"
. - Then cd into the dashboard directory where expo lives and run your eas commands using npx
Whenever you run step 1, it will generate the yarn lock file. Then once you try building, it will copy over yarn lock, use the package.json in the apps folder to do the install (the * basically acts as a wildcard but the yarn lock tells it what to install). It should build correctly then