❯ pnpm run build
\
> @theaistudybible/www@ build /Users/ianpascoe/Code/theaistudybible/apps/www
> vinxi build
vinxi v0.5.4
⚙ Building your app...
vinxi v0.5.4
⚙ Building your router client...
📦 Compiling client router...
vinxi building router client in client mode
♻️ Generating routes...
✅ Processed routes in 139ms
vite v6.2.6 building for production...
[plugin vite:resolve] Module "node:fs" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-client-core@1.115.3/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:path" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-client-core@1.115.3/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:fs" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-client-core@1.115.3/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:path" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-client-core@1.115.3/node_modules/@tanstack/start-client-core/dist/esm/createServerFn.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:stream" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+react-start-server@1.116.0_react-dom@19.1.0_react@19.1.0__react@19.1.0/node_modules/@tanstack/react-start-server/dist/esm/defaultStreamHandler.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:stream/web" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:stream" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
[plugin vite:resolve] Module "node:async_hooks" has been externalized for browser compatibility, imported by "/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/h3.js". See https://vite.dev/guide/troubleshooting.html#module-externalized-for-browser-compatibility for more details.
✓ 3051 modules transformed.
PWA v1.0.0
Building app/service-worker.ts service worker ("es" format)...
vite v6.2.6 building for production...
✓ 70 modules transformed.
.vinxi/build/client/_build/service-worker.mjs 17.12 kB │ gzip: 5.78 kB
✓ built in 101ms
PWA v1.0.0
mode injectManifest
format: es
precache 2 entries (0.00 KiB)
files generated
.vinxi/build/client/_build/service-worker.js
warnings
One of the glob patterns doesn't match any files. Please remove or fix the following: {
"globDirectory": "/Users/ianpascoe/Code/theaistudybible/apps/www/.vinxi/build/client/_build",
"globPattern": "**/*.{js,css,html,png,svg,ico,wasm,webp,woff,woff2,ttf,eot,json,jpg,jpeg,gif,mp3,mp4,wav,avif}",
"globIgnores": [
"**/node_modules/**/*",
"service-worker.js",
"service-worker.js"
]
}
✗ Build failed in 6.79s
ERROR [vite-plugin-pwa:build] There was an error during the build: 11:32:32 AM
../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js (2:9): "Readable" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js".
Additionally, handling the error in the 'buildEnd' hook caused the following error:
../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js (2:9): "Readable" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js".
file: /Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js:2:9
1: import { ReadableStream } from "node:stream/web";
2: import { Readable } from "node:stream";
^
3: import { createControlledPromise } from "@tanstack/router-core";
4: function transformReadableStreamWithRouter(router, routerStream) {
at getRollupError (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/rollup@4.40.0/node_modules/rollup/dist/es/shared/parseAst.js:397:41)
at /Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/rollup@4.40.0/node_modules/rollup/dist/es/shared/node-entry.js:23076:39
at async catchUnfinishedHookActions (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/rollup@4.40.0/node_modules/rollup/dist/es/shared/node-entry.js:22540:16)
at async rollupInternal (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/rollup@4.40.0/node_modules/rollup/dist/es/shared/node-entry.js:23059:5)
at async buildEnvironment (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/vite@6.2.6_@types+node@22.14.1_jiti@2.4.2_lightningcss@1.29.2_terser@5.39.0_tsx@4.19.3_yaml@2.7.1/node_modules/vite/dist/node/chunks/dep-Bid9ssRr.js:51506:14)
at async createViteBuild (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/vinxi@0.5.4_@libsql+client@0.15.3_@types+node@22.14.1_@upstash+redis@1.34.7_db0@0.3.1_@_d95f9dbdce65deaf792ada549192fef2/node_modules/vinxi/lib/build.js:395:17)
at async createRouterBuild (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/vinxi@0.5.4_@libsql+client@0.15.3_@types+node@22.14.1_@upstash+redis@1.34.7_db0@0.3.1_@_d95f9dbdce65deaf792ada549192fef2/node_modules/vinxi/lib/build.js:529:2)
at async /Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/vinxi@0.5.4_@libsql+client@0.15.3_@types+node@22.14.1_@upstash+redis@1.34.7_db0@0.3.1_@_d95f9dbdce65deaf792ada549192fef2/node_modules/vinxi/lib/build.js:59:5
at async createBuild (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/vinxi@0.5.4_@libsql+client@0.15.3_@types+node@22.14.1_@upstash+redis@1.34.7_db0@0.3.1_@_d95f9dbdce65deaf792ada549192fef2/node_modules/vinxi/lib/build.js:58:4)
at async Object.run (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/vinxi@0.5.4_@libsql+client@0.15.3_@types+node@22.14.1_@upstash+redis@1.34.7_db0@0.3.1_@_d95f9dbdce65deaf792ada549192fef2/node_modules/vinxi/bin/cli.mjs:235:5)
at async runCommand (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:316:16)
at async runCommand (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:307:11)
at async runMain (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs:445:7)
ERROR [vite-plugin-pwa:build] There was an error during the build: 11:32:32 AM
../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js (2:9): "Readable" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js".
Additionally, handling the error in the 'buildEnd' hook caused the following error:
../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js (2:9): "Readable" is not exported by "__vite-browser-external", imported by "../../node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js".
file: /Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/@tanstack+start-server-core@1.115.3/node_modules/@tanstack/start-server-core/dist/esm/transformStreamWithRouter.js:2:9
1: import { ReadableStream } from "node:stream/web";
2: import { Readable } from "node:stream";
^
3: import { createControlledPromise } from "@tanstack/router-core";
4: function transformReadableStreamWithRouter(router, routerStream) {
ERROR Exited with code: 1 11:32:32 AM
at CommandChild.pipedStdoutBuffer (/Users/ianpascoe/Code/theaistudybible/node_modules/.pnpm/dax-sh@0.39.2/node_modules/dax-sh/esm/mod.js:9392:19)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
ERROR Exited with code: 1
As a user, I expected my production build to build successfully and not have server/client bundle issues
Which project does this relate to?
Start
Describe the bug
When using
createServerFnsome of the server code is leaking into the client bundle as shown in the warning messages and error below:Your Example Website or App
https://github.com/spirit-led-software/theaistudybible
Steps to Reproduce the Bug or Issue
pnpm buildfrom withinapps/wwwExpected behavior
As a user, I expected my production build to build successfully and not have server/client bundle issues
Screenshots or Videos
No response
Platform
Additional context
No response