-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Description
Which project does this relate to?
Start
Describe the bug
Import protection based on file patterns doesn't seem to work with TypeScript path mapping. In reproduction repo I rely on default *.server.* pattern but it seems to not work with user defined patterns too.
What I noticed it that the order of plugins in vite.config.ts matters here. When vite-tsconfig-paths is before tanstackStart plugin protection doesn't work. When I move vite-tsconfig-paths after tanstackStart it seems to work correctly.
In docs and in Create CLI vite-tsconfig-paths plugin is always before tanstackStart plugin so I assume that that it isn't expected behaviour.
Additionally behaviour was slightly different between mock and error behavior option:
- with
mockI got cryptic error message - with
errorI got no errors
Your Example Website or App
https://github.com/wand3r/tanstack-start-import-protection
Steps to Reproduce the Bug or Issue
Repo was created with npm create @tanstack/start@latest. The only changes are in the second commit where I added get-sercret-env.server.ts file with getSecretEnv function and use it in /routes/index.tsx.
- Run dev server with
npm run dev. - Go to
localhost:3000.
Expected behavior
Error page should be displayed with violation traces. Instead standard page is displayed and function from .server.ts file is executed on the client (console.log is printed).
Screenshots or Videos
No response
Platform
- Start Version: 1.132.0
- OS: macOS
- Browser: Chrome
- Browser Version: 145
- Bundler: vite
- Bundler Version: 7.1.7
Additional context
No response