mirror of
https://github.com/qier222/YesPlayMusic.git
synced 2024-11-29 03:48:20 +08:00
d96bd2a547
* refactor: migrate to PNPM * refactor: remove unused import * chore: update lock * refactor!: remove yarn.lock * fix(config/electron-builder): ignore pnpm-lock.yaml * chore: upgrade dependencies
40 lines
979 B
TypeScript
40 lines
979 B
TypeScript
import dotenv from 'dotenv'
|
|
import { builtinModules } from 'module'
|
|
import path from 'path'
|
|
import { visualizer } from 'rollup-plugin-visualizer'
|
|
import { defineConfig } from 'vite'
|
|
import pkg from '../../package.json'
|
|
|
|
dotenv.config({
|
|
path: path.resolve(process.cwd(), '.env'),
|
|
})
|
|
|
|
export default defineConfig({
|
|
root: __dirname,
|
|
build: {
|
|
outDir: '../../dist/main',
|
|
emptyOutDir: true,
|
|
lib: {
|
|
entry: 'index.ts',
|
|
formats: ['cjs'],
|
|
fileName: () => '[name].cjs',
|
|
},
|
|
minify: process.env./* from mode option */ NODE_ENV === 'production',
|
|
sourcemap: process.env./* from mode option */ NODE_ENV === 'debug',
|
|
rollupOptions: {
|
|
external: [
|
|
'electron',
|
|
...builtinModules,
|
|
...Object.keys(pkg.dependencies || {}),
|
|
],
|
|
plugins: [
|
|
visualizer({
|
|
filename: './bundle-stats-main.html',
|
|
gzipSize: true,
|
|
projectRoot: 'packages/main',
|
|
}),
|
|
],
|
|
},
|
|
},
|
|
})
|