axeldelafosse / expo-next-monorepo-example

Create a universal React app using Expo and Next.js in a monorepo

Home Page:https://expo-next-monorepo-example.vercel.app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`yarn dev` logs many warnings

nandorojo opened this issue · comments

Fixed by removing babelrc.json and replacing with babel.config.js in packages/next:

module.exports = function (api) {
  api.cache(true)

  return {
    presets: [
      'next/babel',
      [
        'babel-preset-expo',
        {
          web: { useTransformReactJSXExperimental: true },
        },
      ],
    ],
    plugins: [
      ['@babel/plugin-proposal-class-properties', { loose: true }],
      ['@babel/plugin-proposal-private-methods', { loose: true }],
      ['@babel/plugin-proposal-private-property-in-object', { loose: true }],
      'react-native-reanimated/plugin',
    ],
  }
}

This also fixed #8, we should probably update the repo @axeldelafosse?

actually sorry that snipped does not fix this bug, but it does indeed fix #8

re:

['@babel/plugin-proposal-class-properties', { loose: true }],
['@babel/plugin-proposal-private-methods', { loose: true }],
['@babel/plugin-proposal-private-property-in-object', { loose: true }],

I wanted to find a better way to fix this conflict between next/babel and metro-react-native-babel-preset but didn't find the time yet, sorry.

Should be fixed with 150e28d. Let me know!

I'm still seeing the same logs with the updated .babelrc.json. It also doesn't work for me for the automatic transform, I see this:

Warning: useTransformReactJsxExperimental has been renamed to useTransformReactJSXExperimental (capitalized JSX) in react-native@0.64.0

If I use babel.config.js inside of the next app, it works fine, I just get the loose logs...

module.exports = function (api) {
  api.cache(false)

  return {
    presets: [
      'next/babel',
      [
        'babel-preset-expo',
        {
          web: { useTransformReactJSXExperimental: true }
        }
      ]
    ],
    plugins: [
      ['@babel/plugin-proposal-class-properties', { loose: true }],
      ['@babel/plugin-proposal-private-methods', { loose: true }],
      ['@babel/plugin-proposal-private-property-in-object', { loose: true }],
      'react-native-reanimated/plugin'
    ]
  }
}

Maybe the next adapter or expo babel preset is outdated?

Technically, it's not a breaking issue; my app still builds with this problem. But it logs about 5,000 lines when I run next build. My latest build only logged a few times though.

I tried this config in multiple projects, we should be able to close this issue + #8.

Cool will try soon thanks

Also note that you might need to set this resolution:

"resolutions": {
  "babel-preset-expo": "^8.5.1"
}

in your root package.json and also run rm -rf .next in your next folder to clean things up.

Fixed! No need for the resolution in my case.