use vite-plugin-optimizer instead vite-plugin-resolve

This commit is contained in:
草鞋没号
2022-03-23 19:49:37 +08:00
parent 6c48b270e2
commit 896db3ea08
3 changed files with 14 additions and 14 deletions

View File

@@ -1,7 +1,7 @@
import { builtinModules } from 'module'
import { defineConfig, Plugin } from 'vite'
import vue from '@vitejs/plugin-vue'
import resolve from 'vite-plugin-resolve'
import optimizer from 'vite-plugin-optimizer'
import pkg from '../../package.json'
// https://vitejs.dev/config/
@@ -41,16 +41,16 @@ export default defineConfig({
* @see https://github.com/caoxiemeihao/electron-vue-vite/issues/52
*/
export function resolveElectron(
resolves: Parameters<typeof resolve>[0] = {}
entries: Parameters<typeof optimizer>[0] = {}
): Plugin {
const builtins = builtinModules.filter((t) => !t.startsWith('_'))
/**
* @see https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/resolve#readme
*/
return resolve({
return optimizer({
electron: electronExport(),
...builtinModulesExport(builtins),
...resolves,
...entries,
})
function electronExport() {