| | |
| | | import vue from '@vitejs/plugin-vue' |
| | | import VueSetupExtend from 'vite-plugin-vue-setup-extend'; |
| | | import { fileURLToPath, URL } from 'node:url'; |
| | | // import path from 'node:path'; |
| | | import svgSprites from 'rollup-plugin-svg-sprites'; |
| | | import Inspect from 'vite-plugin-inspect'; |
| | | import path from 'node:path'; |
| | | import json from '@rollup/plugin-json'; |
| | | |
| | | // https://vite.dev/config/ |
| | | export default defineConfig((command, mode) => { |
| | | |
| | | const env = loadEnv(mode, process.cwd(), ''); |
| | | return { |
| | | plugins: [vue(), VueSetupExtend()], |
| | | plugins: [ |
| | | vue(), |
| | | Inspect(), |
| | | VueSetupExtend(), |
| | | json({ |
| | | // 支持按名导入 |
| | | namedExports: true, |
| | | // 生成 compact 版本的 JSON |
| | | compact: true |
| | | }), |
| | | svgSprites({ |
| | | vueComponent: true, |
| | | exclude: ['node_modules/**'], |
| | | symbolId(filePath) { |
| | | const filename = path.basename(filePath); |
| | | return 'icon-' + filename.substring(0, filename.lastIndexOf('.')); |
| | | } |
| | | }), |
| | | ], |
| | | base: './', |
| | | define: { |
| | | 'process.env': env |