/** * 配置参考: https://cli.vuejs.org/zh/config/ */ 'use strict' const path = require('path') // const defaultSettings = require('./src/settings.js') const CopyPlugin = require('copy-webpack-plugin') function resolve(dir) { return path.join(__dirname, dir) } module.exports = { parallel: false, publicPath: '/', // 其他正式环境 // publicPath: process.env.NODE_ENV === 'production' ? process.env.VUE_APP_BASE_HOUZHUI : '/', //公司内部环境 assetsDir: 'static', chainWebpack: config => { const svgRule = config.module.rule('svg') svgRule.uses.clear() svgRule .test(/\.svg$/) .use('svg-sprite-loader') .loader('svg-sprite-loader') }, // 默认打开eslint效验,如果需要关闭,设置成false即可 lintOnSave: false, runtimeCompiler: true, productionSourceMap: false, devServer: { open: true, hot: true, port: 8002, host: '127.0.0.1', overlay: { errors: true, warnings: true }, // proxy: { // // 配置跨域 // '/proxy_url': { // target: 'http://192.168.188.55:30029', // 这里后台的地址模拟的;应该填写真实的后台接口 // changOrigin: true, // 允许跨域 // pathRewrite: { // 路径重写 // '^/proxy_url': '' // 替换target中的请求地址,原请求为 http://127.0.0.1:8000/kuayu 实际请求为 http://127.0.0.1:8000/proxy_url/kuayu // } // } // } proxy: { // 反向代理 '/customProxyCa': { target: 'https://ca.wzeye.cn', changOrigin: true, // 允许跨域 pathRewrite: { // 路径重写 '^/customProxyCa': '/' } }, // 反向代理 '/hz_quguang': { target: process.env.VUE_APP_LOGIN_URL, // 想请求的目标地址 changOrigin: true, // 允许跨域 pathRewrite: { // 路径重写 '^/hz_quguang': '/hz_quguang' } }, // '/ollama': { // target: 'http://localhost:11434', // changOrigin: true, // 允许跨域 // pathRewrite: { // '^/ollama': '' // }, // } } }, configureWebpack: { resolve: { alias: { 'vue': 'vue/dist/vue.esm.js', '@': resolve('src'), '@static': path.resolve(__dirname, 'static') } }, plugins: [ // new CopyPlugin([ // { from: path.resolve(__dirname, './static'), to: 'static' } // ]) new CopyPlugin({ patterns: [ { from: path.resolve(__dirname, 'static'), to: 'static' } ] }) ], // externals: { // 'pdfjs-dist': 'pdfjsLib' // } }, // rem适配 // css: { // loaderOptions: { // postcss: { // plugins: [ // require('postcss-plugin-px2rem')({ // rootValue: 50, // 换算基数, 默认100 ,这样的话把根标签的字体规定为1rem为50px,这样就可以从设计稿上量出多少个px直接在代码中写多上px了。 // exclude: /node_modules/i, // mediaQuery: false, // (布尔值)允许在媒体查询中转换px。 // minPixelValue: 3 // 设置要替换的最小像素值(3px会被转rem)。 默认 0 // }) // ] // } // } // }, pages: { index: { template: 'public/index.html', entry: 'src/page-subspecialty/main.js', filename: 'index.html', title: 'index' } // project: { // template: 'public/project.html', // entry: 'src/page-project/main.js', // filename: 'project.html', // title: 'project' // } } }