开发环境只需要执行【npm run serve】即可启动服务。
如果需要跨域访问,可以通过配置vue.config.js的devServer解决。
该设置在正式环境是无效的。
*
* Vue-CLI项目的核心配置文件
*/
const webpack = require('webpack')
const MonacoWebpackPlugin = require('monaco-editor-webpack-plugin')
const path = require('path')
const resolve = dir => {
return path.join(__dirname, dir);
};
module.exports = {
// vue cli3.3之后废除了baseUrl,在这之后需要使用 publicPath
publicPath: process.env.NODE_ENV === 'development' ? '/' : './',
chainWebpack: config => {
config.plugin('jquery').use(webpack.ProvidePlugin, [{
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery'
}])
config.plugin('monaco-editor').use(MonacoWebpackPlugin, [{}])
},
devServer: {
before(app) {
},
open: true,
https: false,
// host: 'localhost',
// port: 8081,
proxy: {
'/prms/api': {
target: 'http://localhost:80