const webpack = require('webpack') const path = require('path') // const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin; /** * 配置参考: * https://cli.vuejs.org/zh/config/ */ // const url = 'http://47.94.55.72:9999/';//之前的线上地址 // const url = 'http://test.lovecode.cc:9999/';//线上地址 // const url = 'http://192.168.1.105:9999/';//线下地址 // const url = 'http:// 172.16.36.67:9999/';//线下地址 // // const port = process.env.port || process.env.npm_config_port || 80 // 端口 module.exports = { // const port = process.env.port || process.env.npm_config_port || 80 // 端口 devServer: { host: '0.0.0.0', // port: port, open: true, proxy: { // detail: https://cli.vuejs.org/config/#devserver-proxy [process.env.VUE_APP_BASE_API]: { // target: `https://www.keyitest.cn/prod-api`, //target: `http://192.168.1.105:9999`,//之前 target: process.env.VUE_APP_BASE_TARGET, changeOrigin: true, pathRewrite: { ['^' + process.env.VUE_APP_BASE_API]: '' } } }, disableHostCheck: true, // before (app, server) { // app.get(/.*.(js)$/, (req, res, next) => { // req.url = req.url + '.gz' // res.set('Content-Encoding', 'gzip') // next() // }) // } }, configureWebpack: { resolve:{ alias:{ '@':path.resolve(__dirname,'src') } }, plugins: [ // new webpack.ProvidePlugin({ 'window.Quill': 'quill/dist/quill.js', 'Quill': 'quill/dist/quill.js' }), // new BundleAnalyzerPlugin() ], }, lintOnSave: true, productionSourceMap: false, chainWebpack: config => { config.plugin('provide').use(webpack.ProvidePlugin, [{ $: 'jquery', jquery: 'jquery', jQuery: 'jquery', 'window.jQuery': 'jquery' }]) // xss攻击 config.module .rule("vue") .use("vue-loader") .loader("vue-loader") .tap(options => { options.compilerOptions.directives = { html(node, directiveMeta) { (node.props || (node.props = [])).push({ name: "innerHTML", value: `Xss(_s(${directiveMeta.value}))` }); } }; return options; }) }, // baseUrl: "/",//二级目录 // chainWebpack: config => { // // 忽略的打包文件 // config.externals({ // 'axios': 'axios' // }); // }, // 配置转发代理 // devServer: { // disableHostCheck: true, // proxy: { // // '/static': { // // target: url, // // ws: true, // // pathRewrite: { // // '^/Resource': '/Resource' // // } // // }, // '/': { // target: url, // ws: true, // pathRewrite: { // '^/': '/' // } // }, // } // }, }