-
Notifications
You must be signed in to change notification settings - Fork 60
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
Assets not included #69
Comments
I don't know what you're missing. Please provide a reproducible issue and I'll be happy to look. Also, please check out this example and compare to your own setup: https://github.com/richardtallent/vite-plugin-singlefile-example |
Thanks for the replay, It is very easy to reproduce my situation. npm create vite@latest and add single file plugin npm run build. There are still assets directory and a svg files that did not added into the single file. Thanks |
I think what @makerstorage is taking about is the limitation of not including images. Like, if you create an empty react app you will have something like this (with NO images): I think the problem is here: If you change (manually, of course) that It would be great if this project could just use the |
That's what I am saying. Thanks for the clarification @JuanQP |
Inlining of SVG isn't supported directly by Vite, so it isn't supported directly here either. You'll need to use something like https://github.com/jpkleemans/vite-svg-loader, or put your SVG directly into the template. |
If it's more important to load the assets and having everything in a single file is not that important, have a look at this small plugin I've made and check if it suits your needs. I've used it with a few small projects I have without problems. |
ProblemHi, I encountered exactly the same situation (Vite + React + vite-plugin-singlefile) and noticed that logos are not rendered correctly. I also noticed that even the official test project vite-plugin-singlefile-example would build a html that the favicon cannot be rendered on the browser tab in offline mode (check the console error). ReasonThe root cause is that static resources (such images like SolutionIn
I fixed this and make it the recommended build config (see PR #86 ). Before it's merged, you can set P.S.In my version of Vite (5.0.11) and React (18.2.0), if I put |
I have tested this plugin with vite default example. The assets are built in a dir in the dist folder. I also use
{ useRecommendedBuildConfig: true } but nothing change.
What am I missing? How can I get a single html file in the dist folder after build?
The text was updated successfully, but these errors were encountered: