Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
2Senn opened this issue Sep 2, 2024 · 4 comments
Open

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

2Senn opened this issue Sep 2, 2024 · 4 comments

Comments

@2Senn
Copy link

2Senn commented Sep 2, 2024

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
Copy link
Member

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
Copy link
Author

2Senn commented Sep 2, 2024

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

@juliusmarminge
Copy link
Member

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
Copy link
Author

2Senn commented Sep 3, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants