代码拉取完成,页面将自动刷新
'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()
}
};
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。