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

Error when importing telefunc that is outside sub-project root in monorepo (metro already configured, and RN is 0.72 which supports symlink) #94

Closed
pencilcheck opened this issue Dec 31, 2023 · 3 comments
Labels
bug 💥 Something isn't working

Comments

@pencilcheck
Copy link

pencilcheck commented Dec 31, 2023

Folder structure:

  • project-new-expo/apps has two sub folders:
  • func -> contains just telefunc files
  • expo -> contains the expo code which imports the telefunc file
error: ../func/hello.telefunc.ts: /Users/pencilcheck/Projects/project-new-expo/apps/func/hello.telefunc.ts: [telefunc@0.1.67][Bug] You stumbled upon a bug in Telefunc's source code. Reach out at https://github.com/brillout/telefunc/issues/new or https://discord.com/invite/3DYWwk4xRQ and include this error stack (the error stack is usually enough to fix the problem). A maintainer will fix the bug (usually under 24 hours). Don't hesitate to reach out as it makes Telefunc more robust.
Error: [telefunc@0.1.67][Bug] You stumbled upon a bug in Telefunc's source code. Reach out at https://github.com/brillout/telefunc/issues/new or https://discord.com/invite/3DYWwk4xRQ and include this error stack (the error stack is usually enough to fix the problem). A maintainer will fix the bug (usually under 24 hours). Don't hesitate to reach out as it makes Telefunc more robust.
    at transformTelefuncFileClientSideSync (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/telefunc/dist/cjs/node/transformer/transformTelefuncFileClientSideSync.js:10:24)
    at PluginPass.Program (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/telefunc/dist/cjs/node/babel/plugin.js:69:115)
    at newFn (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/visitors.js:160:14)
    at NodePath._call (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/path/context.js:46:20)
    at NodePath.call (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/path/context.js:36:17)
    at NodePath.visit (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/path/context.js:82:31)
    at TraversalContext.visitQueue (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/context.js:86:16)
    at TraversalContext.visitSingle (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/context.js:65:19)
    at TraversalContext.visit (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/context.js:109:19)
    at traverseNode (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/traverse-node.js:22:17)
    at traverse (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/traverse/lib/index.js:52:34)
    at transformFile (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/core/lib/transformation/index.js:82:31)
    at transformFile.next (<anonymous>)
    at run (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/core/lib/transformation/index.js:24:12)
    at run.next (<anonymous>)
    at /Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/core/lib/transform-ast.js:23:33
    at Generator.next (<anonymous>)
    at evaluateSync (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/gensync/index.js:251:28)
    at sync (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/gensync/index.js:89:14)
    at stopHiding - secret - don't use this - v1 (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/core/lib/errors/rewrite-stack-trace.js:47:12)
    at transformFromAstSync (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/@babel/core/lib/transform-ast.js:43:83)
    at Object.transform (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/metro-react-native-babel-transformer/src/index.js:201:20)
    at transformJSWithBabel (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/metro-transform-worker/src/index.js:330:45)
    at transform (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/metro-transform-worker/src/index.js:461:18)
    at transform (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/react-native-css-interop/dist/metro/transformer.js:15:16)
    at Object.transform (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/nativewind/dist/metro/transformer.js:25:40)
    at transformFile (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/metro/src/DeltaBundler/Worker.flow.js:73:36)
    at Object.transform (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/metro/src/DeltaBundler/Worker.flow.js:48:10)
    at execFunction (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/jest-worker/build/workers/processChild.js:137:17)
    at execHelper (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/jest-worker/build/workers/processChild.js:116:5)
    at execMethod (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/jest-worker/build/workers/processChild.js:120:5)
    at process.messageListener (/Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/jest-worker/build/workers/processChild.js:38:7)
@pencilcheck pencilcheck changed the title Error when importing telefunc that is outside project root in monorepo (metro already configured, and RN is 0.72 which supports symlink) Error when importing telefunc that is outside sub-project root in monorepo (metro already configured, and RN is 0.72 which supports symlink) Dec 31, 2023
@brillout
Copy link
Owner

Insert the following line before line 10 of /Users/pencilcheck/Projects/project-new-expo/apps/expo/node_modules/telefunc/dist/cjs/node/transformer/transformTelefuncFileClientSideSync.js and report back the log results.

    const telefuncFilePath = '/' + path_1.posix.relative(appRootDir, id);
+   console.log('telefuncFilePath', telefuncFilePath);
    (0, utils_1.assert)(!telefuncFilePath.startsWith('/.'));

@brillout brillout added the bug 💥 Something isn't working label Dec 31, 2023
@pencilcheck
Copy link
Author

pencilcheck commented Dec 31, 2023

Only include the relevant logs, the rest are metro and expo stuff

transform[stdout]: telefuncFilePath /../func/hello.telefunc.mjs
Android Bundling failed 1937ms
error: ../func/hello.telefunc.mjs: /Users/pencilcheck/Projects/project-new-expo/apps/func/hello.telefunc.mjs: [telefunc@0.1.67][Bug] You stumbled upon a bug in Telefunc's source code. Reach out at https://github.com/brillout/telefunc/issues/new or https://discord.com/invite/3DYWwk4xRQ and include this error stack (the error stack is usually enough to fix the problem). A maintainer will fix the bug (usually under 24 hours). Don't hesitate to reach out as it makes Telefunc more robust.

@brillout
Copy link
Owner

brillout commented Jan 1, 2024

Fixed. You should now get an helpful error message instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 💥 Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants