Skip to content

Commit ee1c92e

Browse files
committed
removed deprecated splitVendorChunkPlugin
1 parent 432bb87 commit ee1c92e

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

vite/vite.config.js

+16-4
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@
1212
// (this happens because our Vite code is outside the server public access,
1313
// if it were, we could use https://vitejs.dev/config/server-options.html#server-origin)
1414

15-
import { defineConfig, splitVendorChunkPlugin } from 'vite'
15+
import { defineConfig } from 'vite'
1616
import vue from '@vitejs/plugin-vue'
1717
import liveReload from 'vite-plugin-live-reload'
18-
import path from 'node:path'
18+
import { resolve } from 'node:path'
1919

2020
// https://vitejs.dev/config/
2121
export default defineConfig({
@@ -29,7 +29,6 @@ export default defineConfig({
2929
// using this for our example:
3030
__dirname + '/../public/*.php',
3131
]),
32-
splitVendorChunkPlugin(),
3332
],
3433

3534
// config
@@ -48,7 +47,20 @@ export default defineConfig({
4847

4948
// our entry
5049
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+
},
5264
}
5365
},
5466

0 commit comments

Comments
 (0)