t3-oss / create-t3-turbo

Clean and simple starter repo using the T3 Stack along with Expo React Native
https://turbo.t3.gg
MIT License
4.54k stars 379 forks source link

bug: Requiring ts-node in app.config.ts makes app crash #1170

Open 2Senn opened 2 weeks ago

2Senn commented 2 weeks ago

Provide environment information

System: OS: Linux 6.10 Fedora Linux 39 (KDE Plasma) CPU: (12) x64 Intel(R) Core(TM) i7-10750H CPU @ 2.60GHz Memory: 9.34 GB / 15.47 GB Container: Yes Shell: 5.9 - /usr/bin/zsh Binaries: Node: 20.12.0 - ~/.nvm/versions/node/v20.12.0/bin/node npm: 10.8.3 - ~/.nvm/versions/node/v20.12.0/bin/npm pnpm: 9.9.0 - ~/.local/share/pnpm/pnpm

Describe the bug

I have a custom plugin that I want to call in my app.config.ts like so:

// import "ts-node/register";

import type { ConfigContext, ExpoConfig } from "expo/config";

/**
 * @param config ExpoConfig coming from the static config app.json if it exists
 *
 * You can read more about Expo's Configuration Resolution Rules here:
 * https://docs.expo.dev/workflow/configuration/#configuration-resolution-rules
 */
module.exports = ({ config }: ConfigContext): Partial<ExpoConfig> => {
  const existingPlugins = config.plugins ?? [];

  return {
    ...config,
    plugins: [
      ...existingPlugins,
      require("./plugins/withSplashScreen").withSplashScreen,
    ],
  };
};

I need to import ts-node to be able to use the plugin but the app crashes when I do that with this error:

value.replace is not a function

What am i doing wrong?

Link to reproduction

just spin up a create t3 turbo app and install ts-node then try adding it to the app.config.ts

To reproduce

.

Additional information

No response

juliusmarminge commented 2 weeks ago

Is this monorepo related?CI don't see how this is relevant to this repo.

I suggest opening a support request at one of Expo's forums

2Senn commented 2 weeks ago

I assumed it is since the project works just fine outside the monorepo structure

juliusmarminge commented 2 weeks ago

i still don't know what to register and where?

it's a ts file, why do you even need to load ts-node? historically i've never gotten ts-node to work ootb for anything lol...

2Senn commented 2 weeks ago

Ugh I never want to use it either. I wish I never need to see "require" too.

If you heard of the ignite template for native apps this is how their file looks like and it has ts-node imported. I am not really sure why but it is necessary to make the splashscreen (native module) plugin to work.

I am trying to use the ignite template along with the turbo repo and here we are.