Parcourir la source

添加config文件

306132416@qq.com il y a 4 ans
Parent
commit
fa9a3c4611
1 fichiers modifiés avec 36 ajouts et 0 suppressions
  1. 36 0
      code/vue.config.js

+ 36 - 0
code/vue.config.js

@@ -0,0 +1,36 @@
+// "use strict";
+const path = require('path')
+
+function resolve(dir) {
+  return path.join(__dirname, dir)
+}
+
+const port = process.env.port || process.env.npm_config_port || 8081 // dev port
+
+module.exports = {
+  // 生成环境配置
+  // 默认按部署在服务器根路径配置
+  // 编译时资源按相对路径声明,可部署在任意路径
+  publicPath: './',
+  outputDir: 'dist',
+  assetsDir: 'static',
+  lintOnSave: process.env.NODE_ENV === 'development',
+  productionSourceMap: false,
+  filenameHashing: true,
+  devServer: {
+    disableHostCheck: true, // 解决 Invalid Host header
+    port: port,
+    host: 'localhost',
+    overlay: {
+      warnings: false,
+      errors: true
+    },
+    proxy: {
+      '/api': {
+        target: 'http://localhost:8080/',
+        changeOrigin: true
+      }
+    }
+  },
+
+}