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

telefunc/vite doesn't read the root project #144

Open
rtritto opened this issue Feb 5, 2025 · 6 comments
Open

telefunc/vite doesn't read the root project #144

rtritto opened this issue Feb 5, 2025 · 6 comments
Labels
enhancement ✨ New feature or request

Comments

@rtritto
Copy link
Contributor

rtritto commented Feb 5, 2025

Telefunc Vite plugin doesn't use viteConfig.root to load the Vite root that points to ./src instead of ./.

Reproduction

  Vike v0.4.220  ready in 2562 ms
  ➜  press h + enter to show help
Server running at http://localhost:3000
23:57:21 [vike][request(1)] HTTP request: /
23:57:21 [vike][request(1)] HTTP response / 200
[[email protected]][Warning] We recommend the name of your telefunction default() (/_telefunc/testTelefunc.telefunc.ts) to start with "on", see https://telefunc.com/event-based#naming-convention'
Error: ENOENT: no such file or directory, scandir 'C:\template-vike-solid-daisyui-hono\_telefunc'
    at Object.readdirSync (node:fs:1502:26)
    at NodeFS.readdirSync (C:\template-vike-solid-daisyui-hono\.pnp.cjs:6236:26)
    at makeCallSync.subPath.subPath (C:\template-vike-solid-daisyui-hono\.pnp.cjs:6914:26)
    at ZipOpenFS.makeCallSync (C:\template-vike-solid-daisyui-hono\.pnp.cjs:7020:14)
    at ZipOpenFS.readdirSync (C:\template-vike-solid-daisyui-hono\.pnp.cjs:6913:17)
    at VirtualFS.readdirSync (C:\template-vike-solid-daisyui-hono\.pnp.cjs:5817:24)
    at PosixFS.readdirSync (C:\template-vike-solid-daisyui-hono\.pnp.cjs:5817:24)
    at NodePathFS.readdirSync (C:\template-vike-solid-daisyui-hono\.pnp.cjs:5817:24)
    at assertCollocation (C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\runTelefunc\assertNamingConvention.js:48:32)
    at assertNamingConvention (C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\runTelefunc\assertNamingConvention.js:9:5)
    at C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\runTelefunc\findTelefunction.js:28:65
    at findTelefunction (C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\runTelefunc\findTelefunction.js:31:7)
    at runTelefunc_ (C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\runTelefunc.js:87:70)
    at runTelefunc (C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\runTelefunc.js:38:16)
    at telefunc (C:\template-vike-solid-daisyui-hono\.yarn\__virtual__\telefunc-virtual-1154c1b1f4\4\Users\<USER>\AppData\Local\Yarn\Berry\cache\telefunc-patch-73b7fb8a6a-10c0.zip\node_modules\telefunc\dist\cjs\node\server\telefunc.js:11:26)
    at telefuncHandler (C:\template-vike-solid-daisyui-hono\src\server\telefunc-handler.ts:5:24)
    at dispatch (file:///C:/Users/<USER>/AppData/Local/Yarn/Berry/cache/hono-npm-4.6.20-476f4e6f76-10c0.zip/node_modules/hono/dist/compose.js:30:17)
    at file:///C:/Users/<USER>/AppData/Local/Yarn/Berry/cache/hono-npm-4.6.20-476f4e6f76-10c0.zip/node_modules/hono/dist/hono-base.js:195:25
    at responseViaResponseObject (file:///C:/template-vike-solid-daisyui-hono/.yarn/__virtual__/@hono-node-server-virtual-062fe8956e/4/Users/<USER>/AppData/Local/Yarn/Berry/cache/@hono-node-server-npm-1.13.8-8f90b77492-10c0.zip/node_modules/@hono/node-server/dist/index.mjs:351:13)
@rtritto rtritto changed the title telefunc/vite doesn't read src directory telefunc/vite doesn't read the root project Feb 5, 2025
@brillout
Copy link
Owner

brillout commented Feb 6, 2025

Is that related to Yarn PnP? Can you reproduce it with pnpm instead of Yarn?

@rtritto
Copy link
Contributor Author

rtritto commented Feb 6, 2025

Is that related to Yarn PnP?

No.

Can you reproduce it with pnpm instead of Yarn?

Yes, I will add the repro with pnpm.

@brillout
Copy link
Owner

brillout commented Feb 6, 2025

👍 Neat, looking forward to it.

@rtritto
Copy link
Contributor Author

rtritto commented Feb 6, 2025

Branch updated

  Vike v0.4.220  ready in 904 ms
  ➜  press h + enter to show help
Server running at http://localhost:3000
19:55:09 [vike][request(1)] HTTP request: /
19:55:09 [vike][request(1)] HTTP response / 200
[[email protected]][Warning] We recommend the name of your telefunction default() (/_telefunc/testTelefunc.telefunc.ts) to start with "on", see https://telefunc.com/event-based#naming-convention'
Error: ENOENT: no such file or directory, scandir 'C:\template-vike-solid-daisyui-hono\_telefunc'
    at Object.readdirSync (node:fs:1502:26)
    at assertCollocation (C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\runTelefunc\assertNamingConvention.js:48:32)
    at assertNamingConvention (C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\runTelefunc\assertNamingConvention.js:9:5)
    at C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\runTelefunc\findTelefunction.js:28:65
    at findTelefunction (C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\runTelefunc\findTelefunction.js:31:7)
    at runTelefunc_ (C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\runTelefunc.js:87:70)
    at runTelefunc (C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\runTelefunc.js:38:16)
    at telefunc (C:\template-vike-solid-daisyui-hono\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]\node_modules\telefunc\dist\cjs\node\server\telefunc.js:11:26)
    at telefuncHandler (C:\template-vike-solid-daisyui-hono\src\server\telefunc-handler.ts:5:24)
    at dispatch (file:///C:/template-vike-solid-daisyui-hono/node_modules/.pnpm/[email protected]/node_modules/hono/dist/compose.js:30:17)     
    at file:///C:/template-vike-solid-daisyui-hono/node_modules/.pnpm/[email protected]/node_modules/hono/dist/hono-base.js:195:25
    at responseViaResponseObject (file:///C:/template-vike-solid-daisyui-hono/node_modules/.pnpm/@[email protected][email protected]/node_modules/@hono/node-server/dist/index.mjs:351:13)

@brillout brillout added the enhancement ✨ New feature or request label Feb 6, 2025
@brillout
Copy link
Owner

brillout commented Feb 6, 2025

I could reproduce 👍 Nice minimal reproduction.

I'll take a stab at it next week (or PR welcome if that's something you'd be up for; see

const { telefuncFilesLoaded, telefuncFilesAll } = await loadTelefuncFiles(runContext)
and
const viteDevServer = getViteDevServer()
which I believe exposes viteDevServer.config.root).

In the meantime I think https://telefunc.com/root may do the trick?

@brillout
Copy link
Owner

I'm quite busy wit high priorities, so I'm de-prioritizing this since it has a workaround. PR welcome though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement ✨ New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants