Skip to content

Next + Native-Base errorΒ #39

@gern132

Description

@gern132

Hello there! We are trying to use this monorepo to have a project with RN for mobile part and Next.js + NativeBase for the web. The issue that after we installed NativeBase in monorepo we got an errors and we think that the problem is lying somewhere in monorepo setup. BTW RN + NativeBase in monorepo works fine. To understand the issue we also tryed to run a new project (outside monorepo) with Next+NativeBase setup and thats works fine! Could you please give us a hint how to solve that issue, will be really appreciate for this

Error looks like:

Screenshot 2022-01-21 at 18 12 39

This is our next config, with integrated config from NativeBase docs (https://docs.nativebase.io/install-next)

const withImages = require("next-images");

const withFonts = require("next-fonts");
const withTM = require("next-transpile-modules")([
  "react-native-web",
  "native-base",
]);
const { withExpo } = require("@expo/next-adapter");

module.exports = withTM(
  withExpo(
    withImages(
      withFonts({
        typescript: {
          ignoreBuildErrors: true,
        },
        experimental: {
          externalDir: true,
        },

        images: {
          disableStaticImages: true,
        },
        webpack: (config, options) => {
          config.module.rules.push({
            test: /\.mobile.(ts|tsx)$/,
            loader: "ignore-loader",
          });

          if (options.isServer) {
            config.externals = [
              "react",
              "react-native-web",
              ...config.externals,
            ];
          }
          config.resolve.alias["react"] = path.resolve(
            __dirname,
            ".",
            "node_modules",
            "react"
          );
          config.resolve.alias["react-dom"] = path.resolve(
            __dirname,
            ".",
            "node_modules",
            "react-dom"
          );
          config.resolve.alias["react-native-web"] = path.resolve(
            __dirname,
            ".",
            "node_modules",
            "react-native-web"
          );

          return config;
        },
      })
    )
  )
);

### INFORMATION

  1. We try to use 11.x.x and 12.0.4 next versions (Because of expo webpack5 support we tryed a different next versions)
  2. To integrate NativeBase we create a new directory(inside monorepo) and install NextJS with NativeBase (https://docs.nativebase.io/install-next) from scratch - not work
  3. Also tryed to install NativeBase into existing NextJS project - got the same errors as for step 2

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions