在 Vue.js + Vite.js 中禁用代码分割(块)

And*_*ter 8 javascript vue.js rollupjs vuejs3 vite

如何在构建项目时使用Rollup.js禁用 Vue.js + Vite.js中的分块?

我尝试过这样但对我不起作用:

export default defineConfig({
    build: {
        rollupOptions: {
            output: {
                manualChunks: {}
            }
        }
    }
})
Run Code Online (Sandbox Code Playgroud)

kur*_*tko 4

这对我有用(对于 React,我认为它也应该适用于 Vue):

import { defineConfig } from 'vite' // 2.8.0
import react from '@vitejs/plugin-react' // 1.0.7

export default defineConfig ({
  plugins: [react()],
  build: {
    rollupOptions: {
      output: {
        manualChunks: {}
      },
    },
  },
})
Run Code Online (Sandbox Code Playgroud)