enable expo experimental tree shaking
This commit is contained in:
@@ -17,6 +17,10 @@ ENV CI=1
|
|||||||
# use the pnpm version specified in package.json
|
# use the pnpm version specified in package.json
|
||||||
ENV pnpm_config_pm_on_fail=download
|
ENV pnpm_config_pm_on_fail=download
|
||||||
|
|
||||||
|
# Metro's web export needs far more heap than Node's default (~1GB in the
|
||||||
|
# container), which crashes the bundle step with a V8 OOM.
|
||||||
|
ENV NODE_OPTIONS="--max-old-space-size=8192"
|
||||||
|
|
||||||
# The latest git hash of the preview branch on render.com
|
# The latest git hash of the preview branch on render.com
|
||||||
# https://render.com/docs/docker-secrets#environment-variables-in-docker-builds
|
# https://render.com/docs/docker-secrets#environment-variables-in-docker-builds
|
||||||
ARG RENDER_GIT_COMMIT
|
ARG RENDER_GIT_COMMIT
|
||||||
|
|||||||
@@ -1,3 +1,24 @@
|
|||||||
|
/**
|
||||||
|
* React Compiler tags generated nodes with loc = Symbol(GeneratedSource),
|
||||||
|
* which breaks the structuredClone Metro performs on the AST when
|
||||||
|
* EXPO_UNSTABLE_TREE_SHAKING is enabled. Strip them after all other
|
||||||
|
* transforms have run.
|
||||||
|
*/
|
||||||
|
const stripSymbolLocs = () => ({
|
||||||
|
post(file) {
|
||||||
|
file.path.traverse({
|
||||||
|
enter(path) {
|
||||||
|
if (typeof path.node.loc === 'symbol') {
|
||||||
|
path.node.loc = undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
if (typeof file.ast.program.loc === 'symbol') {
|
||||||
|
file.ast.program.loc = undefined
|
||||||
|
}
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {import("@babel/core").ConfigAPI} api
|
* @param {import("@babel/core").ConfigAPI} api
|
||||||
* @returns {import("@babel/core").InputOptions}
|
* @returns {import("@babel/core").InputOptions}
|
||||||
@@ -45,6 +66,7 @@ module.exports = function (api) {
|
|||||||
: []),
|
: []),
|
||||||
...(api.env('production') ? ['transform-remove-console'] : []),
|
...(api.env('production') ? ['transform-remove-console'] : []),
|
||||||
|
|
||||||
|
stripSymbolLocs,
|
||||||
'react-native-worklets/plugin', // NOTE: this plugin MUST be last
|
'react-native-worklets/plugin', // NOTE: this plugin MUST be last
|
||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -47,7 +47,7 @@
|
|||||||
"web": "expo start --web",
|
"web": "expo start --web",
|
||||||
"use-build-number": "./scripts/useBuildNumberEnv.sh",
|
"use-build-number": "./scripts/useBuildNumberEnv.sh",
|
||||||
"use-build-number-with-bump": "./scripts/useBuildNumberEnvWithBump.sh",
|
"use-build-number-with-bump": "./scripts/useBuildNumberEnvWithBump.sh",
|
||||||
"build-web": "expo export --platform web --source-maps && node ./scripts/post-web-build.js",
|
"build-web": "EXPO_UNSTABLE_METRO_OPTIMIZE_GRAPH=1 EXPO_UNSTABLE_TREE_SHAKING=1 expo export --platform web --source-maps && node ./scripts/post-web-build.js",
|
||||||
"build-all": "pnpm intl:build && pnpm use-build-number-with-bump eas build --platform all",
|
"build-all": "pnpm intl:build && pnpm use-build-number-with-bump eas build --platform all",
|
||||||
"build-ios": "pnpm use-build-number-with-bump eas build -p ios",
|
"build-ios": "pnpm use-build-number-with-bump eas build -p ios",
|
||||||
"build-android": "pnpm use-build-number-with-bump eas build -p android",
|
"build-android": "pnpm use-build-number-with-bump eas build -p android",
|
||||||
|
|||||||
Reference in New Issue
Block a user