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

Error: You may need an appropriate loader to handle this file type

FilipeCovas opened this issue · comments

hi, i followed the guide to start the package and gave this error when running yarn dev:expo, does anyone know how I can solve it?

Screenshot Capture - 2021-11-07 - 19-53-09

This is usually a next transpile modules issue. Did you clone the repo or make it yourself

This is usually a next transpile modules issue. Did you clone the repo or make it yourself

Hi Fernando, thanks for the reply, I cloned the repo

If it's any help - to get react-native-vector-icons working on next I modified the next.config.js.

I first installed next-fonts as a dev dependancy on expo. Then I included it in the next.config.js by doing the following

const { withExpo } = require('@expo/next-adapter')
const withPlugins = require('next-compose-plugins')
const withBundleAnalyzer = require('@next/bundle-analyzer')({
    enabled: process.env.ANALYZE === 'true'
})
const withTM = require('next-transpile-modules')([
    'app',
    '@gorhom/bottom-sheet',
    '@gorhom/portal',
    'dripsy',
    '@dripsy/core'
])
const withFonts = require('next-fonts')
const nextConfig = {}

module.exports = withPlugins(
    [
        withFonts(),
        withTM,
        withBundleAnalyzer,
        [withExpo, { projectRoot: __dirname + '/../..' }]
    ],
    nextConfig
)

I noticed if I changed the order of the array parameter used in withPlugins the next app would crash.

Does anyone know why the order of items in the withPlugins array matters?

You should pass with fonts directly, not call the function.

Does anyone know why the order of items in the withPlugins array matters?

it’s the order in which the next config gets updated, so presumably that matters or someone is incorrectly forwarding. I think expo just has to be last.

@nandorojo Thank you - that was helpful :)

hi, i followed the guide to start the package and gave this error when running yarn dev:expo, does anyone know how I can solve it?

Screenshot Capture - 2021-11-07 - 19-53-09

@FilipeCovas I just realized this issue. You said you ran yarn dev:expo? Did you then open that in the browser? yarn dev:expo should only be used for iOS and Android. For Web, you should use yarn dev:next. Remember, this is for Next.js to run in the browser.

hi, i followed the guide to start the package and gave this error when running yarn dev:expo, does anyone know how I can solve it?

Screenshot Capture - 2021-11-07 - 19-53-09

@FilipeCovas I just realized this issue. You said you ran yarn dev:expo? Did you then open that in the browser? yarn dev:expo should only be used for iOS and Android. For Web, you should use yarn dev:next. Remember, this is for Next.js to run in the browser.

Hi @nandorojo, thank you very much for the clarification 🙏🏼🙌🏼

@axeldelafosse maybe we should add that to the readme to make it clearer how to run each platform. The yarn dev: commands are useful to mention either way.