You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have created a brand new react-vite project using yarn create vite . --template=react-ts
When I launched the dev server, I found that in the Network tab all my source files like main.tsx and App.tsx are included, which is obviously undesirable due to security reasons. Newly created files are also included as ts files.
What I expect is that ts files should not be included, only the final minified js script
Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
This is how Vite works fundamentally. In dev, the source files are served as is and transformed to JS. If you want to build them away, you need to build your project with vite build and preview it.
Thank you! So you claim that if experience this behaviour in production, that signifies that I run my prod with 'dev bundle' instead of the one generated by vite build?
Yes, if you see that, you may be running the dev server and using that server as-is in prod, which will have many other issues. Not to be mistaken though with production sourcemaps, as they can display the file structure and original code in the sources tab (not the network tab).
Describe the bug
I have created a brand new
react-vite
project usingyarn create vite . --template=react-ts
When I launched the dev server, I found that in the
Network
tab all my source files likemain.tsx
andApp.tsx
are included, which is obviously undesirable due to security reasons. Newly created files are also included asts
files.What I expect is that
ts
files should not be included, only the final minified js scriptReproduction
https://github.com/vladmw5/react-vite-ts-test
Steps to reproduce
Run
yarn dev
Visit the local server
Open devtools (F12)
Open the Network tab
Toggle
All
and See*.tsx
and*.ts
files being fetchedSystem Info
Used Package Manager
yarn
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: