1 Star 0 Fork 0

AntonioniChiang/QuickProject_UI

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
vue.config.js 3.24 KB
一键复制 编辑 原始数据 按行查看 历史
850715177 提交于 2021-05-05 20:01 . first commit
'use strict';
const defaultSettings = require('./src/settings.js');
// Node.js path 模块提供用于处理文件路径的小工具
const path = require('path');
function resolve(dir) {
// Node.js 中,__dirname 总是指向被执行 js 文件(当前js文件)的绝对路径
// 连接路径
return path.join(__dirname, dir);
}
const name = defaultSettings.title; // page title
// If your port is set to 80,
// use administrator privileges to execute the command line.
// For example, Mac: sudo npm run
// You can change the port by the following methods:
// port = 9528 npm run dev OR npm run dev --port = 9528
const port = process.env.VUE_APP_PORT || 9527; // dev port
// All configuration item explanations can be find in https://cli.vuejs.org/config/
module.exports = {
/**
* You will need to set publicPath if you plan to deploy your site under a sub path,
* for example GitHub Pages. If you plan to deploy your site to https://foo.github.io/bar/,
* then publicPath should be set to "/bar/".
* In most cases please use '/' !!!
* Detail: https://cli.vuejs.org/config/#publicpath
*/
publicPath: '/',
outputDir: 'dist', // build 输出路径
assetsDir: 'static', // 静态资源路径
lintOnSave: process.env.NODE_ENV === 'development', // 开发环境下通过 eslint-loader 在每次保存时 lint 代码。这个值会在 @vue/cli-plugin-eslint 被安装之后生效。
productionSourceMap: false, // 如果你不需要生产环境的 source map,可以将其设置为 false 以加速生产环境构建。
devServer: {
port: port,
open: true,
overlay: {
warnings: false,
errors: true
},
proxy: {
'/dev-api': {
// 此处的写法,目的是为了 将 /dev-api 替换成 https://www.baidu.com/
target: 'http://127.0.0.1:11010/',
// 允许跨域
changeOrigin: true,
ws: true,
pathRewrite: {
'^/dev-api': ''
}
},
'/prod-api': {
// 此处的写法,目的是为了 将 /api 替换成 https://www.baidu.com/
target: 'http://192.168.0.72:8051/',
// 允许跨域
changeOrigin: true,
ws: true,
pathRewrite: {
'^/prod-api': ''
}
}
}
},
configureWebpack: {
// provide the app's title in webpack's name field, so that
// it can be accessed in index.html to inject the correct title.
name: name,
resolve: {
alias: {
'@': require('path').join(__dirname, 'src')
}
}
},
chainWebpack(config) {
// set svg-sprite-loader
config.module
.rule('svg')
.exclude.add(resolve('src/icons'))
.end()
config.module
.rule('icons')
.test(/\.svg$/)
.include.add(resolve('src/icons'))
.end()
.use('svg-sprite-loader')
.loader('svg-sprite-loader')
.options({
symbolId: 'icon-[name]'
})
.end()
}
};
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
JavaScript
1
https://gitee.com/antonionichiang/QuickProject_UI.git
git@gitee.com:antonionichiang/QuickProject_UI.git
antonionichiang
QuickProject_UI
QuickProject_UI
master

搜索帮助