|
|
@@ -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
|
|
|
+ }
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
+}
|