vite.config.ts 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import { defineConfig } from 'vite'
  2. import vue from '@vitejs/plugin-vue'
  3. import path from 'path'
  4. export default defineConfig({
  5. base: "./", //设置打包路径
  6. // 打包配置
  7. // build: {
  8. // sourcemap: true,
  9. // outDir: 'distp', // 指定输出路径,要和库的包区分开
  10. // assetsDir: 'static/img/', // 指定生成静态资源的存放路径
  11. // brotliSize: false, // 不统计
  12. // target: 'esnext',
  13. // minify: 'esbuild', // 混淆器,terser构建后文件体积更小
  14. // rollupOptions: {
  15. // output: {
  16. // chunkFileNames: 'static/js/[name]-[hash].js',
  17. // entryFileNames: 'static/js/[name]-[hash].js',
  18. // assetFileNames: 'static/[ext]/[name]-[hash].[ext]'
  19. // },
  20. // }
  21. // },
  22. plugins: [vue()],
  23. resolve: {
  24. alias: {
  25. '@': path.resolve(__dirname, './src') // 设置别名
  26. }
  27. },
  28. build: {
  29. outDir: 'dist',
  30. assetsDir: 'static'
  31. },
  32. // server: {
  33. // host: '0.0.0.0',
  34. // port: 6090, //设置服务启动端口
  35. // //open: true, //设置服务启动时是否自动打开浏览器
  36. // cors: true, //默认启用并允许任何源
  37. // //设置代理
  38. // proxy: {
  39. // '/api': {
  40. // target: 'http://114.242.31.4:6090', //请求的域名地址
  41. // changeOrigin: true, //是否允许跨域代理
  42. // secure: false,
  43. // rewrite: (path) => path.replace(/^\/api/, '') // 重定向地址
  44. // }
  45. // }
  46. // },
  47. css: {
  48. preprocessorOptions: {
  49. scss: {
  50. // 关闭编译时 字符编码 报错问题
  51. charset: false,
  52. },
  53. },
  54. },
  55. })