Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

DamageInc's avatar

Vite in production

Hi, i am testing the new integration with vite, everything works fine, but when i run npm run build vite generates one javascirpt file per component, what i need to change to make vite generate a vendor file and another file for all the other components?

0 likes
6 replies
DamageInc's avatar

If anyone was having the same problem the solution was to change this line in app.js:

resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.glob('./Pages/**/*.vue')), ​

to

resolve: (name) => resolvePageComponent(`./Pages/${name}.vue`, import.meta.globEager('./Pages/**/*.vue')), ​

Sinnbeck's avatar

@Damage Inc Not sure why you want to disable code splitting :) If its just because you want to compile all vendor files into one file, you can use manualChunks`: let me know if you want help implementing that instead.

Anyways. I just tested it, and my IDE complains that globEager() is deprecated.

The official docs says to use

resolve: (name) => resolvePageComponent(./Pages/${name}.vue, import.meta.glob('./Pages/**/*.vue', {eager: true})),
DamageInc's avatar

@Sinnbeck is just because i don't want like 10-15 requests to the server (even if they are small files) every time the user changes from one part of the system to another

Sinnbeck's avatar

@Damage Inc Ok cool. But I still suggest you use the syntax from the docs, just in case the globEager function is removed.

Please or to participate in this conversation.