mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
remove vite-plugin-electron-config
This commit is contained in:
parent
775e2f9818
commit
a2df7d335d
@ -35,26 +35,15 @@ export default defineConfig({
|
|||||||
|
|
||||||
// ------- For use Electron, NodeJs in Renderer-process -------
|
// ------- For use Electron, NodeJs in Renderer-process -------
|
||||||
// https://github.com/caoxiemeihao/electron-vue-vite/issues/52
|
// https://github.com/caoxiemeihao/electron-vue-vite/issues/52
|
||||||
export function resolveElectron(resolves: Parameters<typeof resolve>[0] = {}): Plugin[] {
|
export function resolveElectron(resolves: Parameters<typeof resolve>[0] = {}): Plugin {
|
||||||
const builtins = builtinModules.filter(t => !t.startsWith('_'))
|
const builtins = builtinModules.filter(t => !t.startsWith('_'))
|
||||||
|
|
||||||
return [
|
|
||||||
{
|
|
||||||
name: 'vite-plugin-electron-config',
|
|
||||||
config(config) {
|
|
||||||
if (!config.optimizeDeps) config.optimizeDeps = {}
|
|
||||||
if (!config.optimizeDeps.exclude) config.optimizeDeps.exclude = []
|
|
||||||
|
|
||||||
config.optimizeDeps.exclude.push('electron', ...builtins)
|
|
||||||
},
|
|
||||||
},
|
|
||||||
// https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/resolve#readme
|
// https://github.com/caoxiemeihao/vite-plugins/tree/main/packages/resolve#readme
|
||||||
resolve({
|
return resolve({
|
||||||
electron: electronExport(),
|
electron: electronExport(),
|
||||||
...builtinModulesExport(builtins),
|
...builtinModulesExport(builtins),
|
||||||
...resolves,
|
...resolves,
|
||||||
})
|
})
|
||||||
]
|
|
||||||
|
|
||||||
function electronExport() {
|
function electronExport() {
|
||||||
return `
|
return `
|
||||||
|
Loading…
x
Reference in New Issue
Block a user