Skip to content

build(babel): enable class static blocks for three.js bundling#86

Open
epicexcelsior wants to merge 1 commit into
anonmesh:stagingfrom
epicexcelsior:hotfix/babel-class-static-blocks
Open

build(babel): enable class static blocks for three.js bundling#86
epicexcelsior wants to merge 1 commit into
anonmesh:stagingfrom
epicexcelsior:hotfix/babel-class-static-blocks

Conversation

@epicexcelsior
Copy link
Copy Markdown
Collaborator

@epicexcelsior epicexcelsior commented May 20, 2026

Summary

iOS bundling has been silently failing because mobile_app/ had no babel.config.js and babel-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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant