毫秒镜像
木雷坞 · MLIEV
externalizeDepsPlugin The externalizeDepsPlugin is deprecated. In v5, you can use build.externalizeDeps to customize this behavior. This feature is enabled by default, so you no longer need to import the plugin.
import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import { defineConfig } from 'electron-vite'
export default defineConfig({
main: {
plugins: [externalizeDepsPlugin()]
},
preload: {
plugins: [externalizeDepsPlugin()]
}
// ...
})bytecodePlugin The bytecodePlugin is deprecated. In v5, you can use build.bytecode to enable or customize this feature.
import { defineConfig, bytecodePlugin } from 'electron-vite'
import { defineConfig } from 'electron-vite'
export default defineConfig({
main: {
plugins: [bytecodePlugin()]
build: {
bytecode: true
}
},
preload: {
plugins: [bytecodePlugin()]
build: {
bytecode: true
}
},
// ...
})import { defineConfig, bytecodePlugin } from 'electron-vite'
import { defineConfig } from 'electron-vite'
export default defineConfig({
main: {
plugins: [bytecodePlugin({ protectedStrings: ['foo'] })]
build: {
bytecode: { protectedStrings: ['foo'] }
}
},
// ...
})In v5, function-based configuration is no longer supported for nested config fields such as main, preload, or renderer. Instead, you should directly define static configuration objects.
import { defineConfig, defineViteConfig } from 'electron-vite'
export default defineConfig({
main: {
// ...
},
preload: {
// ...
},
renderer: defineViteConfig(({ command, mode }) => { ❌
// ...
})
})