1 Star 0 Fork 7

大胖小渣/publicElectronapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
vite.config.ts 1.59 KB
一键复制 编辑 原始数据 按行查看 历史
Shaohqfspace 提交于 2024-01-10 19:16 . 1.10
import { rmSync } from 'fs'
import path from 'path'
import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import electron, { onstart } from 'vite-plugin-electron'
import pkg from './package.json'
function pathResolve(dir) {
return path.resolve(process.cwd(), '.', dir);
}
rmSync('dist', { recursive: true, force: true }) // v14.14.0
// https://vitejs.dev/config/
export default defineConfig({
resolve: {
alias: {
'@': pathResolve('src') + '/',
'@views': pathResolve('./src/views') + '/',
}
},
plugins: [
vue(),
electron({
main: {
entry: 'electron/main/index.ts',
vite: {
build: {
// For Debug
sourcemap: true,
outDir: 'dist/electron/main',
},
// Will start Electron via VSCode Debug
plugins: [process.env.VSCODE_DEBUG ? onstart() : null],
},
},
preload: {
input: {
// You can configure multiple preload here
index: path.join(__dirname, 'electron/preload/index.ts'),
},
vite: {
build: {
// For Debug
sourcemap: 'inline',
outDir: 'dist/electron/preload',
},
},
},
// Enables use of Node.js API in the Renderer-process
// https://github.com/electron-vite/vite-plugin-electron/tree/main/packages/electron-renderer#electron-renderervite-serve
renderer: {},
}),
],
server: process.env.VSCODE_DEBUG ? {
host: pkg.debug.env.VITE_DEV_SERVER_HOSTNAME,
port: pkg.debug.env.VITE_DEV_SERVER_PORT,
} : undefined,
})
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/big-fat-little-slag/public-electronapp.git
git@gitee.com:big-fat-little-slag/public-electronapp.git
big-fat-little-slag
public-electronapp
publicElectronapp
master

搜索帮助