-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(expo) : Update to Expo 50 #795
Changes from 17 commits
4c9c269
c4be4aa
3abb0f3
e332d80
cd47aa2
759459f
6a10316
aae6e9c
c7dcc41
b283a38
95be156
aab72d6
dbc1f1c
a069ae1
8c23e75
c13d231
6cb3490
f78b5f2
edd9462
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,11 @@ | ||
/** @type {import("@babel/core").ConfigFunction} */ | ||
module.exports = function (api) { | ||
api.cache.forever(); | ||
|
||
api.cache(true); | ||
return { | ||
presets: [ | ||
["babel-preset-expo", { jsxImportSource: "nativewind" }], | ||
"nativewind/babel", | ||
], | ||
plugins: [ | ||
require.resolve("expo-router/babel"), | ||
require.resolve("react-native-reanimated/plugin"), | ||
], | ||
plugins: ["react-native-reanimated/plugin"], | ||
}; | ||
}; |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👀 not needed anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not sure why the |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,55 @@ | ||
// Learn more: https://docs.expo.dev/guides/monorepos/ | ||
const { getDefaultConfig } = require("@expo/metro-config"); | ||
const { getDefaultConfig } = require("expo/metro-config"); | ||
const { FileStore } = require("metro-cache"); | ||
const { withNativeWind } = require("nativewind/metro"); | ||
|
||
const path = require("path"); | ||
|
||
const projectRoot = __dirname; | ||
const workspaceRoot = path.resolve(projectRoot, "../.."); | ||
module.exports = withTurborepoManagedCache( | ||
withMonorepoPaths( | ||
withNativeWind(getDefaultConfig(__dirname), { | ||
input: "./src/styles.css", | ||
configPath: "./tailwind.config.ts", | ||
}), | ||
), | ||
); | ||
|
||
// Create the default Metro config | ||
const config = getDefaultConfig(projectRoot, { isCSSEnabled: true }); | ||
/** | ||
* Add the monorepo paths to the Metro config. | ||
* This allows Metro to resolve modules from the monorepo. | ||
* | ||
* @see https://docs.expo.dev/guides/monorepos/#modify-the-metro-config | ||
* @param {import('expo/metro-config').MetroConfig} config | ||
* @returns {import('expo/metro-config').MetroConfig} | ||
*/ | ||
function withMonorepoPaths(config) { | ||
const projectRoot = __dirname; | ||
const workspaceRoot = path.resolve(projectRoot, "../.."); | ||
|
||
if (config.resolver) { | ||
// 1. Watch all files within the monorepo | ||
// #1 - Watch all files in the monorepo | ||
config.watchFolders = [workspaceRoot]; | ||
// 2. Let Metro know where to resolve packages and in what order | ||
|
||
// #2 - Resolve modules within the project's `node_modules` first, then all monorepo modules | ||
config.resolver.nodeModulesPaths = [ | ||
path.resolve(projectRoot, "node_modules"), | ||
path.resolve(workspaceRoot, "node_modules"), | ||
]; | ||
// 3. Force Metro to resolve (sub)dependencies only from the `nodeModulesPaths` | ||
config.resolver.disableHierarchicalLookup = true; | ||
|
||
return config; | ||
} | ||
|
||
// @ts-expect-error - FIXME: type is mismatching? | ||
module.exports = withNativeWind(config, { | ||
input: "./src/styles.css", | ||
configPath: "./tailwind.config.ts", | ||
}); | ||
/** | ||
* Move the Metro cache to the `node_modules/.cache/metro` folder. | ||
* This repository configured Turborepo to use this cache location as well. | ||
* If you have any environment variables, you can configure Turborepo to invalidate it when needed. | ||
* | ||
* @see https://turbo.build/repo/docs/reference/configuration#env | ||
* @param {import('expo/metro-config').MetroConfig} config | ||
* @returns {import('expo/metro-config').MetroConfig} | ||
*/ | ||
function withTurborepoManagedCache(config) { | ||
config.cacheStores = [ | ||
new FileStore({ root: path.join(__dirname, "node_modules/.cache/metro") }), | ||
]; | ||
return config; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,7 +5,7 @@ | |
"main": "expo-router/entry", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this should work according to their docs? did they go back? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should work fine. We did discover an issue in We know about that issue, and will fix it as soon as we can! |
||
"scripts": { | ||
"clean": "git clean -xdf .expo .turbo node_modules", | ||
"dev": "expo start --ios", | ||
"dev": "expo start", | ||
"dev:android": "expo start --android", | ||
"dev:ios": "expo start --ios", | ||
"android": "expo run:android", | ||
|
@@ -15,26 +15,27 @@ | |
"typecheck": "tsc --noEmit" | ||
}, | ||
"dependencies": { | ||
"@expo/metro-config": "^0.10.7", | ||
"@shopify/flash-list": "1.4.3", | ||
"@expo/metro-config": "^0.17.3", | ||
"@shopify/flash-list": "1.6.3", | ||
"@tanstack/react-query": "^5.17.7", | ||
"@trpc/client": "11.0.0-next-beta.236", | ||
"@trpc/react-query": "11.0.0-next-beta.236", | ||
"@trpc/server": "11.0.0-next-beta.236", | ||
"expo": "^49.0.21", | ||
"expo-constants": "~14.4.2", | ||
"expo-linking": "~5.0.2", | ||
"expo-router": "2.0.14", | ||
"expo-splash-screen": "~0.22.0", | ||
"expo-status-bar": "~1.7.1", | ||
"nativewind": "^4.0.22", | ||
"expo": "~50.0.4", | ||
"expo-constants": "~15.4.5", | ||
"expo-linking": "~6.2.2", | ||
"expo-router": "~3.4.6", | ||
"expo-splash-screen": "~0.26.4", | ||
"expo-status-bar": "~1.11.1", | ||
"nativewind": "~4.0.13", | ||
"react": "18.2.0", | ||
"react-dom": "18.2.0", | ||
"react-native": "0.73.1", | ||
"react-native-gesture-handler": "~2.12.0", | ||
"react-native-reanimated": "~3.3.0", | ||
"react-native-safe-area-context": "4.6.3", | ||
"react-native-screens": "~3.22.1", | ||
"react-native": "~0.73.2", | ||
"react-native-css-interop": "~0.0.13", | ||
"react-native-gesture-handler": "~2.14.0", | ||
"react-native-reanimated": "~3.6.2", | ||
"react-native-safe-area-context": "~4.8.2", | ||
"react-native-screens": "~3.29.0", | ||
"superjson": "2.2.1" | ||
}, | ||
"devDependencies": { | ||
|
@@ -43,11 +44,10 @@ | |
"@acme/prettier-config": "workspace:^0.1.0", | ||
"@acme/tailwind-config": "workspace:^0.1.0", | ||
"@acme/tsconfig": "workspace:^0.1.0", | ||
"@babel/core": "^7.23.7", | ||
"@babel/preset-env": "^7.23.7", | ||
"@babel/runtime": "^7.23.7", | ||
"@expo/config-plugins": "^7.2.5", | ||
"@types/babel__core": "^7.20.4", | ||
"@babel/core": "^7.23.9", | ||
"@babel/preset-env": "^7.23.9", | ||
"@babel/runtime": "^7.23.9", | ||
"@types/babel__core": "^7.20.5", | ||
"@types/react": "^18.2.48", | ||
"eslint": "^8.56.0", | ||
"prettier": "^3.1.1", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we nuke this file all together now? I think strict-peer-dependencies was also set for expo reasons
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can on the native side! We've been working hard to get rid of all implicit dependency references in both
/android
and/ios
folders.That means things like
expo run android|ios
are working as intended, withoutnode-linker=hoisted
.Unfortunately, there are a few left-over issues, e.g.
eas update
won't work properly with this yet. Working hard to resolve them before SDK 50 stable is released.