You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
68 lines
1.8 KiB
68 lines
1.8 KiB
import { defineConfig,loadEnv} from "vite";
|
|
import vue from "@vitejs/plugin-vue";
|
|
import path from "path";
|
|
import { rmSync } from "fs";
|
|
import electron from "vite-plugin-electron";
|
|
import { resolve } from 'path'
|
|
rmSync('dist', { recursive: true, force: true });
|
|
rmSync('node_modules/electron-edge-js/build', { recursive: true, force: true })
|
|
export default defineConfig(({ mode }) => {
|
|
const env = loadEnv(mode, __dirname)
|
|
return {
|
|
plugins: [
|
|
vue(),
|
|
electron([
|
|
{
|
|
entry: 'src/background.ts',
|
|
vite: {
|
|
build: {
|
|
sourcemap: false,
|
|
outDir: 'electron',
|
|
rollupOptions: {
|
|
// Here are some C/C++ plugins that can't be built properly.
|
|
external: [
|
|
'electron-edge-js',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
{
|
|
entry: 'src/preload.ts',
|
|
vite: {
|
|
build: {
|
|
sourcemap: false,
|
|
outDir: 'electron',
|
|
rollupOptions: {
|
|
// Here are some C/C++ plugins that can't be built properly.
|
|
external: [
|
|
'electron-edge-js',
|
|
],
|
|
},
|
|
},
|
|
},
|
|
},
|
|
])
|
|
],
|
|
esbuild: {
|
|
drop: ['console', 'debugger'],
|
|
},
|
|
base: './',
|
|
alias: {
|
|
"@": path.resolve(__dirname, 'src'),
|
|
'*': resolve('')
|
|
},
|
|
build: {
|
|
outDir: "dist",
|
|
assetsDir: "assets", //指定静态资源存放路径
|
|
sourcemap: false, //是否构建source map 文件
|
|
// terserOptions: {
|
|
// // 生产环境移除console
|
|
// compress: {
|
|
// drop_console: true,
|
|
// drop_debugger: true,
|
|
// },
|
|
// },
|
|
},
|
|
}
|
|
})
|