TypeError: (0 , __vite_ssr_import_11__.u) is not a function
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 15.1k
- Forks
- 1.9k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 143
Description
Which project does this relate to?
Start
Describe the bug
System Info
System:
- OS: Windows 11 10.0.26200
- CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12450H
- Memory: 4.34 GB / 15.71 GB
- Binaries:
- Node: 24.13.1 - C:\Users\kar\scoop\apps\nodejs-lts\current\node.EXE
- npm: 11.8.0 - C:\Users\kar\scoop\apps\nodejs-lts\current\npm.CMD
- pnpm: 11.1.1 - C:\Users\kar\scoop\shims\pnpm.EXE
- bun: 1.3.9 - C:\Users\kar\scoop\shims\bun.EXE
other info:
- @tanstack/react-router: 1.169.2
- @tanstack/react-start: 1.167.65
- wrangler: 4.92.0
- @cloudflare/vite-plugin: 1.37.1
Description
If I add @cloudflare/vite-plugin in the project's vite.config.ts and running dev server, the start will throw error:
PS E:\readen> pnpm run dev-web
$ pnpm --filter @readest/readest-app dev-web
$ dotenv -e .env.web -- vite dev
(node:27460) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
Using secrets defined in .env
VITE v8.0.13 ready in 12715 ms
➜ Local: http://localhost:5173/
➜ Network: use --host to expose
➜ Debug: http://localhost:5173/__debug
➜ press b + enter to list configured Cloudflare bindings
➜ press e + enter to open local explorer
➜ press t + enter to start tunnel
➜ press h + enter to show help
🌼 daisyUI 4.12.24
├─ ✔︎ 24 themes added https://daisyui.com/docs/themes
╰─ ❤︎ Support daisyUI project: https://opencollective.com/daisyui
TypeError: (0 , __vite_ssr_import_11__.u) is not a function
at runInRunnerObject (workers/runner-worker/index.js:107:3)
... 5 lines matching cause stack trace ...
at maybeCaptureError (workers/runner-worker/index.js:51:10) {
cause: TypeError: (0 , __vite_ssr_import_11__.u) is not a function
at runInRunnerObject (workers/runner-worker/index.js:107:3)
at async Promise.all (index 0)
at loadEntries (E:/readen/node_modules/.pnpm/@tanstack+start-server-core@1.167.30/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:351:53)
at startRequestResolver (E:/readen/node_modules/.pnpm/@tanstack+start-server-core@1.167.30/node_modules/@tanstack/start-server-core/src/createStartHandler.ts:684:23)
at Object.fetch (E:/readen/node_modules/.pnpm/@tanstack+react-start@1.167_f6291eabd0fa275f3000be2506700c3c/node_modules/@tanstack/react-start/src/default-entry/server.ts:16:14)
at Object.fetch (E:/readen/node_modules/.pnpm/@tanstack+react-start@1.167_f6291eabd0fa275f3000be2506700c3c/node_modules/@tanstack/react-start/src/default-entry/server.ts:16:14)
at maybeCaptureError (workers/runner-worker/index.js:51:10) {
remote: true
},
status: 500,
statusText: undefined,
headers: undefined,
data: undefined,
body: undefined,
unhandled: true
}
➜ Tunnel closed
The vite.config.ts file:
import path from "node:path";
import { cloudflare } from "@cloudflare/vite-plugin";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
import viteReact from "@vitejs/plugin-react";
import { defineConfig } from "vite";
export default defineConfig(() => {
return {
plugins: [
cloudflare({
viteEnvironment: { name: "ssr" },
}),
tanstackStart({
srcDirectory: "./src",
router: {
routesDirectory: "app",
routeFileIgnorePattern:
"(components|utils|hooks|services|context|store|types|helpers|libs)|ShareLanding.tsx|SharePage.tsx|shareRoute.ts|OpenAnnotationPage.tsx|ReaderContent.tsx|ReaderRoutePage.tsx|readerSearch.ts|not-found.tsx|render.tsx",
// Bundle all UI components (component, pending, error, notFound) for a
// route into one chunk separate from the route definition + loader.
// Reduces the per-route waterfall and shrinks the eager route shell.
codeSplittingOptions: {
defaultBehavior: [
[
"component",
"pendingComponent",
"errorComponent",
"notFoundComponent",
],
],
},
},
}),
viteReact(),
],
resolve: {
tsconfigPaths: true,
alias: [
{
find: /^@\/components\/ui\/(.*)/,
replacement: path.resolve("src/components/primitives/$1"),
},
{
find: /^@pdfjs\/(.*)/,
replacement: path.resolve("public/vendor/pdfjs/$1"),
},
{
find: /^@simplecc\/(.*)/,
replacement: path.resolve("public/vendor/simplecc/$1"),
},
{ find: /^@\/(.*)/, replacement: path.resolve("src/$1") },
{
find: "js-mdict",
replacement: path.resolve("../../packages/js-mdict/src/index.ts"),
},
],
},
build: {
sourcemap: true,
rolldownOptions: {
platform: "browser",
},
rollupOptions: {
external: ["tauri-plugin-turso", "js-mdict"],
onwarn(warning, defaultHandler) {
if (
warning.message?.includes(
"Can't resolve original location of error",
)
)
return;
defaultHandler(warning);
},
},
},
ssr: {
noExternal: ["tinycolor2"],
},
optimizeDeps: {
include: ["react", "react-dom", "fflate"],
},
};
});
Complete minimal reproducer
https://github.com/0x0501/readen
Steps to Reproduce the Bug
- clone the repo: https://github.com/0x0501/readen
- install dependencies:
# might need to rerun this when code is updated
git submodule update --init --recursive
pnpm install
# copy vendors dist libs to public directory
pnpm --filter @readest/readest-app setup-vendors
- add
@cloudflare/vite-plugintoapps/readest-app/vite.config.ts - running
pnpm run dev-web
Expected behavior
No error occurred when running pnpm run dev-web.
Screenshots or Videos
No response
Platform
System:
- OS: Windows 11 10.0.26200
- CPU: (12) x64 12th Gen Intel(R) Core(TM) i5-12450H
- Memory: 4.34 GB / 15.71 GB
- Binaries:
- Node: 24.13.1 - C:\Users\kar\scoop\apps\nodejs-lts\current\node.EXE
- npm: 11.8.0 - C:\Users\kar\scoop\apps\nodejs-lts\current\npm.CMD
- pnpm: 11.1.1 - C:\Users\kar\scoop\shims\pnpm.EXE
- bun: 1.3.9 - C:\Users\kar\scoop\shims\bun.EXE
- browser: Chrome 148.0.7778.168 (Official Build) (64-bit)
other info:
- @tanstack/react-router: 1.169.2
- @tanstack/react-start: 1.167.65
- wrangler: 4.92.0
- @cloudflare/vite-plugin: 1.37.1
Additional context
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure from the linked minimal repository by following the setup steps and running pnpm run dev-web after adding the plugin in apps/readest-app/vite.config.ts. Start with workers/runner-worker/index.js:107 and the TanStack Start createStartHandler frames shown in the stack trace. Done means the development server starts and handles requests without the TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript, vite
- Domain
- build-system, devtools, web-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100