nandorojo / solito

🧍‍♂️ React Native + Next.js, unified.
https://solito.dev
MIT License
3.54k stars 180 forks source link

I really wanted to try this package it looks really cool. I can't get it installed though, #385

Closed thegirlyoucallryan closed 1 year ago

thegirlyoucallryan commented 1 year ago

const { withExpo } = require("@expo/next-adapter");

const withPlugins = require("next-compose-plugins");

I am getting warnings about the require statements, I have ran yarn npm... deleted node modules.
I am trying to install into t3 create turbo because it has the trpc ready to go but I can't get those packages to work in the next.config. I am on my own computer not my works so its windows and I'm running docker and its so slow. Any suggestions.

derek-primumco commented 1 year ago

There is a whole separate issue where someone is trying to install Solito into the t3 create turbo stack https://github.com/nandorojo/solito/issues/377

My recommendation would be either to review that thread and try to help with get that version of a t3-turbo-solito repo working, or flip the approach and try to start with Solito and add T3 back into the Solito stack.

nandorojo commented 1 year ago

i don’t have any useful info to go off of in this issue. you need to share what the errors are

wmonecke commented 1 year ago

I am facing something similar:

/** @type {import('next').NextConfig} */
const { withExpo } = require('@expo/next-adapter');
const { withTamagui } = require('@tamagui/next-plugin');
const withPlugins = require('next-compose-plugins');
const withImages = require('next-images');
const { join } = require('path');

process.env.IGNORE_TS_CONFIG_PATHS = 'true';
process.env.TAMAGUI_TARGET = 'web';
process.env.TAMAGUI_DISABLE_WARN_DYNAMIC_LOAD = '1';

const withTM = require('next-transpile-modules')([
  'solito',
  // add other packages here that need transpiling, such as moti
]);

module.exports = async (phase) => {
  /** @type {import('next').NextConfig} */
  const nextConfig = {
    images: {
      disableStaticImages: true,
    },
    modularizeImports: {
      '@tamagui/lucide-icons': {
        transform: `@tamagui/lucide-icons/dist/esm/icons/{{kebabCase member}}`,
        skipDefaultConversion: true,
      },
    },
    transpilePackages: [
      'solito',
      'react-native-web',
      'expo-linking',
      'expo-constants',
      'expo-modules-core',
    ],
    experimental: {
      // optimizeCss: true,
      scrollRestoration: false,
      legacyBrowsers: false,
    },
  };

  const plugins = [
    withTM,
    [withExpo, { projectRoot: __dirname }],
    withImages,
    withTamagui({
      config: './tamagui.config.ts',
      components: ['uikit', 'tamagui'],
      logTimings: true,
      disableExtraction: process.env.NODE_ENV === 'development',
      // experiment - reduced bundle size react-native-web
      // if this cause any issues, set to false, but to optimize size, use excludeReactNativeWebExports instead
      useReactNativeWebLite: true,
      shouldExtract: (path) => {
        if (
          path.includes(join('modules', 'app')) ||
          path.includes(join('modules', 'shared'))
        ) {
          return true;
        }
      },
    }),
  ];

  // has to be done w/o default config. Issue: https://github.com/cyrilwanner/next-compose-plugins/issues/59
  return withPlugins(plugins, nextConfig)(phase, { undefined });
};

package.json

 "solito": "^3.2.0",
 "next": "^13.0.6",
 "react": "18.2.0",
 "react-dom": "18.2.0",

Then get an error like this one:

warn  -     The root value has an unexpected property, projectRoot, which is not in the list of allowed properties (amp, analyticsId, assetPrefix, basePath, cleanDistDir, compiler, compress, crossOrigin, devIndicators, distDir, env, eslint, excludeDefaultMomentLocales, experimental, exportPathMap, generateBuildId, generateEtags, headers, httpAgentOptions, i18n, images, modularizeImports, onDemandEntries, optimizeFonts, output, outputFileTracing, pageExtensions, poweredByHeader, productionBrowserSourceMaps, publicRuntimeConfig, reactStrictMode, redirects, rewrites, sassOptions, serverRuntimeConfig, skipMiddlewareUrlNormalize, skipTrailingSlashRedirect, staticPageGenerationTimeout, swcMinify, trailingSlash, transpilePackages, typescript, useFileSystemPublicRoutes, webpack).
warn  - See more info here: https://nextjs.org/docs/messages/invalid-next-config

Seems similar to this one: https://github.com/cyrilwanner/next-compose-plugins/issues/59

nandorojo commented 1 year ago

I'm wondering if you're on an old version of expo next adapter. If you're using Tamagui, I would follow their Next.js docs instead of using withPlugins, etc. You can also use transpilePackages from Next.js rather than nextTM now.

nandorojo commented 1 year ago

Those warnings are annoying, but the app still starts fine, so I'm closing this. I think you may need to upgrade expo/next-adapter to the latest version. There's no need to use withExpo if you're using withTamagui.