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
mock I got cryptic error message
- with
error I 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
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.tsmatters here. Whenvite-tsconfig-pathsis beforetanstackStartplugin protection doesn't work. When I movevite-tsconfig-pathsaftertanstackStartit seems to work correctly.In docs and in Create CLI
vite-tsconfig-pathsplugin is always beforetanstackStartplugin so I assume that that it isn't expected behaviour.Additionally behaviour was slightly different between
mockanderrorbehavior option:mockI got cryptic error messageerrorI got no errorsYour 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 addedget-sercret-env.server.tsfile withgetSecretEnvfunction and use it in/routes/index.tsx.npm run dev.localhost:3000.Expected behavior
Error page should be displayed with violation traces. Instead standard page is displayed and function from
.server.tsfile is executed on the client (console.logis printed).Screenshots or Videos
No response
Platform
Additional context
No response