Including @react-three/xr in my project add multiple large files to my build, for example meeting_room-COtFIOij.js and living_room-CVCYIB7e.js
When I include @react-three/xr in my project multiple large .js files are added to my build, for example meeting_room-COtFIOij.js and living_room-CVCYIB7e.js.
Is there any way to prevent this from happening?
Snippet of my package.json:
"@react-three/xr": "6.6.27",
"@react-three/drei": "10.7.5",
"@react-three/fiber": "9.3.0",
"three": "0.180.0",
"typescript": "5.9.2",
"vite": "7.2.4"
Seems like the package @iwer/sem is responsible for adding the files.
@Bossieh these files are not automatically loaded, just when you start the emulator
Thanks for the quick reply.
They appear in my dist folder after building my app.
"scripts": {
"dev": "vite",
"build": "tsc && vite build",
dist/assets/music_room-DAOruTFO.js
dist/assets/office_large-DoJFWIAy.js
yes, but they are not loaded by the browser unless you start the emulator
Yes I understand, but now my build size is increased drastically.
I don't use the emulator at all, I only use the AR functionality. I prefer to only have files in my /dist folder which are actually used.
You can remove them after the build or maybe there's a vite script to exclude the imports that cause them to be included:
const { emulate } = await import('./emulate.js')
Why do you care about build size?
Because I like to keep my build size small.
I guess this would also be nice in my use case, as I'm exporting the app build automatically and zipping it to the user, so i guess the less size the better
just found this today when trying to figure out why I had an old version of three in my build (0.165.0) which apparently is required by @iwer/devui and @iwer/sem which are also in the build. I've handled this in vite config but it would be nice if it could be made optional in /xr. really the emulator should probably be a separate package imo.