Skip to content

Commit

Permalink
fix(vite-flow): use internal resolve to avoid issues in babel resolut…
Browse files Browse the repository at this point in the history
…ion in external monorepos
  • Loading branch information
natew committed Dec 27, 2024
1 parent 9fd5726 commit bf2576b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/vite-flow/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@babel/core": "^7.26.0",
"@babel/plugin-transform-private-methods": "^7.25.9",
"@react-native/babel-plugin-codegen": "^0.76.5",
"@vxrn/resolve": "workspace:^",
"babel-plugin-syntax-hermes-parser": "^0.25.1",
"flow-remove-types": "^2.247.1",
"metro-react-native-babel-preset": "^0.77.0",
Expand Down
3 changes: 2 additions & 1 deletion packages/vite-flow/src/transformFlowBabel.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import babel from '@babel/core'
import { resolvePath } from '@vxrn/resolve'

export async function transformFlowBabel(
input: string,
Expand All @@ -11,7 +12,7 @@ export async function transformFlowBabel(
filename: 'file.js', // this is required for @react-native/babel-plugin-codegen to work.
presets: [
[
'module:metro-react-native-babel-preset',
resolvePath('metro-react-native-babel-preset'),
{
// To use the `@babel/plugin-transform-react-jsx` plugin for JSX.
useTransformReactJSXExperimental: true,
Expand Down
4 changes: 3 additions & 1 deletion packages/vite-flow/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
"composite": true
},
"references": [

{
"path": "../resolve"
},
]
}
1 change: 1 addition & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12526,6 +12526,7 @@ __metadata:
"@biomejs/biome": "npm:^1.8.3"
"@react-native/babel-plugin-codegen": "npm:^0.76.5"
"@tamagui/build": "npm:^1.121.2"
"@vxrn/resolve": "workspace:^"
babel-plugin-syntax-hermes-parser: "npm:^0.25.1"
flow-remove-types: "npm:^2.247.1"
metro-react-native-babel-preset: "npm:^0.77.0"
Expand Down

0 comments on commit bf2576b

Please sign in to comment.