mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-31 20:16:36 +08:00
feat: support use electron in Renderer-process
This commit is contained in:
parent
3b70e26f8b
commit
9476b5fb15
@ -1,13 +1,19 @@
|
|||||||
import { join } from 'path'
|
import { join } from 'path'
|
||||||
import { defineConfig } from 'vite'
|
import { defineConfig } from 'vite'
|
||||||
import vue from '@vitejs/plugin-vue'
|
import vue from '@vitejs/plugin-vue'
|
||||||
|
import resolve from 'vite-plugin-resolve'
|
||||||
import pkg from '../package.json'
|
import pkg from '../package.json'
|
||||||
|
|
||||||
// https://vitejs.dev/config/
|
// https://vitejs.dev/config/
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
mode: process.env.NODE_ENV,
|
mode: process.env.NODE_ENV,
|
||||||
root: join(__dirname, '../src/renderer'),
|
root: join(__dirname, '../src/renderer'),
|
||||||
plugins: [vue()],
|
plugins: [
|
||||||
|
vue(),
|
||||||
|
resolve({
|
||||||
|
electron: 'export default require("electron");',
|
||||||
|
}),
|
||||||
|
],
|
||||||
base: './',
|
base: './',
|
||||||
build: {
|
build: {
|
||||||
emptyOutDir: true,
|
emptyOutDir: true,
|
||||||
@ -17,4 +23,7 @@ export default defineConfig({
|
|||||||
host: pkg.env.HOST,
|
host: pkg.env.HOST,
|
||||||
port: pkg.env.PORT,
|
port: pkg.env.PORT,
|
||||||
},
|
},
|
||||||
|
optimizeDeps: {
|
||||||
|
exclude: ['electron'],
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user