diff --git a/package-lock.json b/package-lock.json index e9db50b..4fe7c98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "simple-git-hooks": "^2.7.0", "typescript": "^4.5.5", "vite": "^2.7.13", - "vite-plugin-resolve": "^1.8.0", + "vite-plugin-optimizer": "^1.1.4", "vue": "^3.2.29", "vue-tsc": "^0.31.1" }, @@ -6105,10 +6105,10 @@ } } }, - "node_modules/vite-plugin-resolve": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/vite-plugin-resolve/-/vite-plugin-resolve-1.8.0.tgz", - "integrity": "sha512-zWj2tsi3GpYbF+RdUi8Bad1MsnOefak4G93yNntlWrHKuxZniGGySMtimp/6Qc5e/DjO8LLstJm7EkdjsZqxjQ==", + "node_modules/vite-plugin-optimizer": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/vite-plugin-optimizer/-/vite-plugin-optimizer-1.1.4.tgz", + "integrity": "sha512-oExg8rJhgALOl6LEg0DYXs8KQSKwLy9JswqtnpKD2RvjwW774O/e9F6EyspdsHRpTDNPvduV1DvHpv4p/DdxRQ==", "dev": true }, "node_modules/void-elements": { @@ -11173,10 +11173,10 @@ "rollup": "^2.59.0" } }, - "vite-plugin-resolve": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/vite-plugin-resolve/-/vite-plugin-resolve-1.8.0.tgz", - "integrity": "sha512-zWj2tsi3GpYbF+RdUi8Bad1MsnOefak4G93yNntlWrHKuxZniGGySMtimp/6Qc5e/DjO8LLstJm7EkdjsZqxjQ==", + "vite-plugin-optimizer": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/vite-plugin-optimizer/-/vite-plugin-optimizer-1.1.4.tgz", + "integrity": "sha512-oExg8rJhgALOl6LEg0DYXs8KQSKwLy9JswqtnpKD2RvjwW774O/e9F6EyspdsHRpTDNPvduV1DvHpv4p/DdxRQ==", "dev": true }, "void-elements": { diff --git a/package.json b/package.json index 24e3db8..fe14748 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "simple-git-hooks": "^2.7.0", "typescript": "^4.5.5", "vite": "^2.7.13", - "vite-plugin-resolve": "^1.8.0", + "vite-plugin-optimizer": "^1.1.4", "vue": "^3.2.29", "vue-tsc": "^0.31.1" }, diff --git a/packages/renderer/vite.config.ts b/packages/renderer/vite.config.ts index bf76ff8..3d0b7e2 100644 --- a/packages/renderer/vite.config.ts +++ b/packages/renderer/vite.config.ts @@ -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[0] = {} + entries: Parameters[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() {