12
12
// (this happens because our Vite code is outside the server public access,
13
13
// if it were, we could use https://vitejs.dev/config/server-options.html#server-origin)
14
14
15
- import { defineConfig , splitVendorChunkPlugin } from 'vite'
15
+ import { defineConfig } from 'vite'
16
16
import vue from '@vitejs/plugin-vue'
17
17
import liveReload from 'vite-plugin-live-reload'
18
- import path from 'node:path'
18
+ import { resolve } from 'node:path'
19
19
20
20
// https://vitejs.dev/config/
21
21
export default defineConfig ( {
@@ -29,7 +29,6 @@ export default defineConfig({
29
29
// using this for our example:
30
30
__dirname + '/../public/*.php' ,
31
31
] ) ,
32
- splitVendorChunkPlugin ( ) ,
33
32
] ,
34
33
35
34
// config
@@ -48,7 +47,20 @@ export default defineConfig({
48
47
49
48
// our entry
50
49
rollupOptions : {
51
- input : path . resolve ( __dirname , 'src/main.js' ) ,
50
+ input : resolve ( __dirname , 'src/main.js' ) ,
51
+ output : {
52
+ manualChunks ( id ) {
53
+ // all third-party code will be in vendor chunk
54
+ if ( id . includes ( 'node_modules' ) ) {
55
+ return 'vendor'
56
+ }
57
+ // example on how to create another chunk
58
+ // if (id.includes('src/'components')) {
59
+ // return 'components'
60
+ // }
61
+ // console.log(id)
62
+ } ,
63
+ } ,
52
64
}
53
65
} ,
54
66
0 commit comments