/* * @Author: your name * @Date: 2020-01-20 08:56:10 * @LastEditTime: 2020-05-28 17:49:57 * @LastEditors: Please set LastEditors * @Description: In User Settings Edit * @FilePath: \admin-frame\vue.config.js */ const path = require('path'); const menu = require(process.env.VUE_APP_MOCK_MENU || './mock/menu'); const frameSrc = path.resolve(__dirname); const baseUrl = '/admin'; module.exports = { // baseUrl: './', publicPath: baseUrl, // : process.env.VUE_APP_ROOT_URL, productionSourceMap: false, configureWebpack: { resolve: { alias: { '@frame': frameSrc, '@naf': path.join(frameSrc, '/naf'), '@lib': path.join(frameSrc, '/lib'), }, }, }, devServer: { port: 3000, // historyApiFallback: { // disableDotRule: true, // rewrites: [ // { from: /^\/$/, to: path.posix.join(baseUrl, 'loading.html') }, // { from: /\/login/, to: path.posix.join(baseUrl, 'login.html') }, // { from: /\/frame/, to: path.posix.join(baseUrl, 'frame.html') }, // { from: /./, to: path.posix.join(baseUrl, '404.html') }, // ], // }, before(app) { app.use('/api', (req, res, next) => { console.log(`[${req.method}]`, req.path); res.set({ 'Cache-Control': 'no-cache', Pragma: 'no-cache', Expires: -1, }); next(); }); app.use('/api/gaf', menu); }, proxy: { '/admin/gaf': { target: 'http://localhost:3001', }, '/admin/xms': { target: 'http://localhost:3002', }, '/api/gaf/': { target: 'http://192.168.0.120:18080', // pathRewrite: { '^/api': '' }, }, '/api/xms/': { target: 'http://192.168.0.120:18080', // pathRewrite: { '^/api': '' }, }, '/api/': { target: 'http://192.168.0.120:18080', // pathRewrite: { '^/api': '' }, }, '/api/CapturePicture': { target: 'http://127.0.0.1:18090', changeOrigin: true, pathRewrite: { '^/api': '/' }, }, '/api/getcert': { target: 'http://127.0.0.1:18090', changeOrigin: true, pathRewrite: { '^/api': '/' }, }, // '/api/menu/': { // // target: 'http://jit.cc-lotus.info', // // target: 'http://debug.cc-lotus.info', // target: 'http://localhost:8085', // pathRewrite: { '^/api': '/gaf' }, // }, }, }, };