| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- import { defineConfig } from 'vite'
- import vue from '@vitejs/plugin-vue'
- import eslint from 'vite-plugin-eslint'
- import { resolve } from 'path'
- import { createSvgIconsPlugin } from 'vite-plugin-svg-icons'
- import electron from 'vite-plugin-electron'
- export default () => defineConfig({
- base: './',
- resolve: {
- alias: {
- '@': resolve(__dirname, './src')
- }
- },
- plugins: [
- vue(),
- eslint({ fix: true, include: ['**/*.ts', '**/*.vue'] }),
- createSvgIconsPlugin({
- iconDirs: [resolve(__dirname, './src/assets/icons')],
- // Specify symbolId format
- symbolId: 'icon-[dir]-[name]'
- }),
- electron({
- entry: 'electron/main.js',
- vite: { build: { outDir: 'dist/electron/' } }
- }),
- ],
- server: {
- host: '0.0.0.0',
- port: 6547,
- open: false,
- strictPort: false,
- https: false,
- },
- // esbuild: {
- // drop: ['console', 'debugger'] // build 移除打印
- // },
- build: {
- rollupOptions: {
- input: {
- index: resolve(__dirname, 'index.html')
- },
- output: { // 静态资源分类打包
- chunkFileNames: 'js/[hash].js',
- entryFileNames: 'js/[hash].js',
- assetFileNames: 'assets/[ext]/[hash].[ext]',
- // 拆分node_modules包
- manualChunks: (id) => {
- if (id.includes('node_modules')) {
- return id.toString().split('node_modules/')[1].split('/')[0].toString()
- }
- return ''
- }
- }
- },
- outDir: 'dist/electron/'
- },
- define: {
- __VUE_OPTIONS_API__: false
- }
- })
|