Hi there, I am kind of new in the Vite configuration and playcanvas optimizations, I am trying to make an optimized build with the Vite vanilla js with the playcanvas embed that contains a lot of files But I am unable to do it so Is it possible?
For more understanding of my project here is its folder structure
| node_modules
| public
–| playcanvas
| .gitignore
| index.html
| main.js
| package-lock.json
| package.json
| style.css
in the main.js I am using an iframe
but when I made a build of it the playcanvas embed size and files did not get optimized or build
Note that I am using vite vanilla Js, not Vue Js
It’s likely that Vite is only building code directly referenced from your entry point (main.js). In this case it’s not aware of your iframed playcanvas code and so ignores it.
It’s not trivial, but you can look at the Vites’ rollup build options where you can set additional entry points, in order to also build your PC project, but it will be tricky to include any game scripts within that.
Improving the dev experience with tools like Vite is something we’ve been looking at
2 Likes
Spoke to the user on Discord.
They were trying to use Vite to optimise the performance and memory usage of the PlayCanvas build. Explained to them that Vite won’t do that for them and they need to actually optimise the project.
3 Likes