Skip to content

Commit 0c8bf8c

Browse files
MatiPl01tomekzaw
andauthored
fix: Web example runtime crash caused by invalid babel config (#8417)
## Summary The `web-example` started crashing in runtime after the #7702 PR was merged. The problem was caused by the no longer existing `babel.js` file under the `react-strict-dom` package directory which was imported in the web example's `babel.config.js` file. Since the `react-strict-dom` now exposes a babel preset that already uses the necessary `@stylexjs/babel-plugin` babel plugin, I was able to simplify our babel config by removing these plugins and replacing them by just the babel preset. ## Before <img width="680" height="60" alt="Screenshot 2025-10-17 at 18 00 22" src="https://github.com/user-attachments/assets/48a349f1-696d-4d06-8dde-5962b115d46a" /> --------- Co-authored-by: Tomasz Zawadzki <[email protected]>
1 parent 2fda791 commit 0c8bf8c

File tree

3 files changed

+1
-43
lines changed

3 files changed

+1
-43
lines changed

apps/web-example/babel.config.js

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,6 @@
1-
const stylexPlugin = require('@stylexjs/babel-plugin');
2-
const rsdPlugin = require('react-strict-dom/babel');
3-
41
/** @type {import('@babel/core').ConfigFunction} */
52
module.exports = function (api) {
63
const plugins = [
7-
rsdPlugin,
8-
[
9-
stylexPlugin,
10-
{
11-
importSources: [
12-
'@stylexjs/stylex',
13-
{ from: 'react-strict-dom', as: 'css' },
14-
],
15-
runtimeInjection: true,
16-
},
17-
],
184
[
195
'module-resolver',
206
{
@@ -36,7 +22,7 @@ module.exports = function (api) {
3622
}
3723

3824
return {
39-
presets: ['babel-preset-expo'],
25+
presets: ['babel-preset-expo', 'react-strict-dom/babel-preset'],
4026
plugins,
4127
};
4228
};

apps/web-example/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
},
2222
"devDependencies": {
2323
"@expo/metro-runtime": "6.1.2",
24-
"@stylexjs/babel-plugin": "0.16.1",
2524
"@types/react": "19.2.2",
2625
"prettier": "3.6.2",
2726
"serve": "14.2.5",

yarn.lock

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -7557,21 +7557,6 @@ __metadata:
75577557
languageName: node
75587558
linkType: hard
75597559

7560-
"@stylexjs/babel-plugin@npm:0.16.1":
7561-
version: 0.16.1
7562-
resolution: "@stylexjs/babel-plugin@npm:0.16.1"
7563-
dependencies:
7564-
"@babel/core": "npm:^7.26.8"
7565-
"@babel/helper-module-imports": "npm:^7.25.9"
7566-
"@babel/traverse": "npm:^7.26.8"
7567-
"@babel/types": "npm:^7.26.8"
7568-
"@dual-bundle/import-meta-resolve": "npm:^4.1.0"
7569-
"@stylexjs/stylex": "npm:0.16.1"
7570-
postcss-value-parser: "npm:^4.1.0"
7571-
checksum: 10/c7e4c7aacc3cc126a1ac76d367e1895b2a0482554a937dc3d8f278f89e741e126c5b96b551a110ae7d80f7063bc538da0138ef3597603f94d89512f364c77d51
7572-
languageName: node
7573-
linkType: hard
7574-
75757560
"@stylexjs/babel-plugin@npm:^0.15.4":
75767561
version: 0.15.4
75777562
resolution: "@stylexjs/babel-plugin@npm:0.15.4"
@@ -7598,17 +7583,6 @@ __metadata:
75987583
languageName: node
75997584
linkType: hard
76007585

7601-
"@stylexjs/stylex@npm:0.16.1":
7602-
version: 0.16.1
7603-
resolution: "@stylexjs/stylex@npm:0.16.1"
7604-
dependencies:
7605-
css-mediaquery: "npm:^0.1.2"
7606-
invariant: "npm:^2.2.4"
7607-
styleq: "npm:0.2.1"
7608-
checksum: 10/265a41980bf329d2f078f8bcf2f94a4a89db6bf0f69714caa120160d881e9edecda3141bdbc1b39284dab02b93821c2e73d071c4c259819c8c377ebf3183d120
7609-
languageName: node
7610-
linkType: hard
7611-
76127586
"@svgr/babel-plugin-add-jsx-attribute@npm:8.0.0":
76137587
version: 8.0.0
76147588
resolution: "@svgr/babel-plugin-add-jsx-attribute@npm:8.0.0"
@@ -30818,7 +30792,6 @@ __metadata:
3081830792
resolution: "web-example@workspace:apps/web-example"
3081930793
dependencies:
3082030794
"@expo/metro-runtime": "npm:6.1.2"
30821-
"@stylexjs/babel-plugin": "npm:0.16.1"
3082230795
"@types/react": "npm:19.2.2"
3082330796
common-app: "workspace:*"
3082430797
expo: "npm:54.0.13"

0 commit comments

Comments
 (0)