vite.config.js 714 B

12345678910111213141516171819202122232425262728
  1. import { defineConfig } from "vite";
  2. import path from "path";
  3. import uni from "@dcloudio/vite-plugin-uni";
  4. // https://vitejs.dev/config/
  5. export default defineConfig(({ mode, command }) => {
  6. return {
  7. base: "./", // 打包路径
  8. server: {
  9. hmr: true, //热更新
  10. host: true, //指定服务器
  11. open: true, //自动打开浏览器
  12. port: 8080, //启动端口
  13. },
  14. plugins: [uni()],
  15. resolve: {
  16. alias: {
  17. "@/": path.resolve(__dirname, "src"),
  18. "@/static": path.resolve(__dirname, "src/static"),
  19. "@/utils": path.resolve(__dirname, "src/utils"),
  20. },
  21. },
  22. configureWebpack: {
  23. externals: {
  24. AMap: "AMap",
  25. },
  26. },
  27. };
  28. });