-
-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
Vite includes source files into the production bundle out of the box #17514
Comments
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 |
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 |
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: