vue.config.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. "use strict";
  2. const path = require("path");
  3. function resolve(dir) {
  4. return path.join(__dirname, dir);
  5. }
  6. const name = process.env.VUE_APP_TITLE || "门店拜访"; // 网页标题
  7. const port = 8888; // 端口
  8. module.exports = {
  9. // publicPath: process.env.NODE_ENV === "production" ? "/mobile/" : "/",
  10. publicPath: "/mobile/",
  11. outputDir: "mobile",
  12. assetsDir: "static",
  13. lintOnSave: false,
  14. productionSourceMap: false,
  15. devServer: {
  16. port: port,
  17. open: true,
  18. proxy: {
  19. [process.env.VUE_APP_BASE_API]: {
  20. target: process.env.VUE_APP_Target,
  21. changeOrigin: true,
  22. pathRewrite: {
  23. ["^" + process.env.VUE_APP_BASE_API]: process.env.VUE_APP_BASE_API + "",
  24. },
  25. },
  26. },
  27. disableHostCheck: true,
  28. },
  29. configureWebpack: {
  30. name: name,
  31. resolve: {
  32. alias: {
  33. "@": resolve("src"),
  34. },
  35. },
  36. },
  37. chainWebpack(config) {
  38. config.plugins.delete("preload"); // TODO: need test
  39. config.plugins.delete("prefetch"); // TODO: need test
  40. config.when(process.env.NODE_ENV !== "development", (config) => {
  41. config.optimization.runtimeChunk("single"),
  42. {
  43. from: path.resolve(__dirname, "./public/robots.txt"), //防爬虫文件
  44. to: "./", //到根目录下
  45. };
  46. });
  47. },
  48. };