build(babel): enable class static blocks for three.js bundling#86
Open
epicexcelsior wants to merge 1 commit into
Open
build(babel): enable class static blocks for three.js bundling#86epicexcelsior wants to merge 1 commit into
epicexcelsior wants to merge 1 commit into
Conversation
three.js (pulled in by the mesh-map renderer) uses ES2022 class static blocks. babel-preset-expo's default target list doesn't include the transform, so iOS bundling fails with "Static class blocks are not enabled" — Metro returns 500 on every bundle request and the dev-client can't fetch JS at all. No babel.config.js existed; this adds one with preset-expo + the missing plugin. The plugin was already in node_modules transitively (pulled in by @babel/preset-env), so this is config-only — no new dep, no native rebuild.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iOS bundling has been silently failing because
mobile_app/had nobabel.config.jsandbabel-preset-expo's default target list doesn't include the class-static-blocks transform. `three.js` (pulled in by the mesh-map renderer) uses ES2022 class static blocks — every iOS bundle request hits this and Metro returns HTTP 500.Net effect: dev-client on iOS has been running JS embedded in the last wireless build rather than live Metro code. Anyone on a clean checkout hits the same break.
Fix
Adds a 13-line `babel.config.js`:
```js
module.exports = function (api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: ['@babel/plugin-transform-class-static-block'],
};
};
```
The plugin is already in `node_modules` transitively (via `@babel/preset-env`). Config-only — no new dep, no native rebuild, no permission/entitlement change.
Risk
Low. The plugin only activates on files that contain the static-block syntax (`static { ... }` inside class). Most app code is unaffected. `three.js` and any other ES2022-using deps get the transform.