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

Very slow tsserver #3945

Open
Malin88 opened this issue Feb 23, 2025 · 7 comments
Open

Very slow tsserver #3945

Malin88 opened this issue Feb 23, 2025 · 7 comments

Comments

@Malin88
Copy link

Malin88 commented Feb 23, 2025

I have a monorepo with two applications, the first one is a honoJS API and the second one is a nextJS application.
If I add a reference to hono in tsconfig.json to use RPC and have nice typing in the nextJS application, tsserver needs 5-10 seconds to check for errors with each change.

Based on the tsserver logs, the most time is spent on "semanticDiag". Has anyone encountered this problem?

my nextJS tsconfig.json:

{
	"extends": "@dr/typescript-config/nextjs.json",
	"compilerOptions": {
		"baseUrl": ".",
		"paths": {
			"@admin/*": ["./src/*"],
			"@dr/ui/*": ["../../packages/ui/src/*"],
			"@api/*": ["../api/src/*"]
		},
		"plugins": [
			{
				"name": "next"
			}
		]
	},
	"include": ["next-env.d.ts", "next.config.mjs", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
	"exclude": ["node_modules"],
	"references": [
		{
			"path": "../api"
		}
	]
}

and for hono:

{
  "compilerOptions": {
    "composite": true,
    "target": "ESNext",
    "jsx": "react-jsx",
    "jsxImportSource": "hono/jsx",
    "rootDir": "./src",
    "module": "ESNext",
    "moduleResolution": "Node",
    "paths": {
      "@/*": ["./src/*"]
    },
    "resolveJsonModule": true,
    "strict": true,
    "declaration": true,
    "declarationMap": true,
    "allowSyntheticDefaultImports": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "noImplicitAny": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "lib": ["ESNext"],
    "outDir": "./dist",
    "baseUrl": ".",
    "forceConsistentCasingInFileNames": true,
    "isolatedModules": true,
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "noFallthroughCasesInSwitch": true
  },
  "include": ["src/**/*"],
  "exclude": ["node_modules", "dist"]
}

@pjeziorowski
Copy link

It's super slow for me too, sveltekit + hono monorepo

@yusukebe
Copy link
Member

This may be related to #3869

@yusukebe
Copy link
Member

Hi @Malin88 @pjeziorowski

This is a known issue and difficult to resolve immediately, but we should do it. Can you share a small project to reproduce it, if possible? I can investigate it.

@Malin88
Copy link
Author

Malin88 commented Mar 2, 2025

@yusukebe This is the project I am currently working on https://github.com/Malin88/next-hono it's quite small for now, but in hono there are 6 routes added. With one everything works +- ok, but when I add more then TS has problems.

@yusukebe
Copy link
Member

yusukebe commented Mar 3, 2025

@Malin88 Thanks. I'll take a look.

@yusukebe
Copy link
Member

yusukebe commented Mar 3, 2025

This related to #3869

@yusukebe
Copy link
Member

yusukebe commented Mar 4, 2025

@Malin88

I tried to use your code for a while. I think the routes to passing the hc are huge. This is a known issue described in the following, and you can avoid it with "Compile your code before using it" way:

https://hono.dev/docs/guides/rpc#compile-your-code-before-using-it-recommended

The completion performance will be improved:

code.mp4

This is a big problem with our RPC feature. We can discuss it at #3869.

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

3 participants