const webpack = require("webpack"); const production = process.env.NODE_ENV === "production"; module.exports = { publicPath: "./", productionSourceMap: false, // 生产打包时不输出map文件,增加打包速度 css: { // 是否使用css分离插件 ExtractTextPlugin extract: false, // 开启 CSS source maps? sourceMap: true, // css预设器配置项 loaderOptions: {}, // 启用 CSS modules for all css / pre-processor files. modules: false, }, runtimeCompiler: true, configureWebpack: { plugins: [ new webpack.ProvidePlugin({ $: "jquery", jQuery: "jquery", "window.jQuery": "jquery", }), ], }, chainWebpack: (config) => { if (process.env.NODE_ENV === "production") { config.plugin("chunkPlugin").use(webpack.optimize.LimitChunkCountPlugin, [ { maxChunks: 6, // 必须大于或等于 1 minChunkSize: 10000, }, ]); } if (!production) { //源码查看配置 config.output.devtoolModuleFilenameTemplate = (info) => { const resPath = info.resourcePath; if ( (/\.vue$/.test(resPath) && !/type=script/.test(info.identifier)) || /node_modules/.test(resPath) ) { return `webpack:///${resPath}?${info.hash}`; } return `webpack:///${resPath.replace("./src", "my-code/src")}`; }; } }, devServer: { open: true, // host: 'localhost', port: 8085, https: false, //以上的ip和端口是我们本机的;下面为需要跨域的 proxy: { //配置跨域 v3: { // target:'https://v5qy.test.baibaodun.cn/', // target: 'http://49.4.123.194:37080/', //这里后台的地址模拟的;应该填写你们真实的后台接口192.168.88.192 // target: "https://v5qy.te.baibaodun.com.cn", // target: "http://v5qytl.test.baibaodun.cn/", target:'https://v5qy.baibaodun.cn/', // target:'http://v5gain.pre.baibaodun.cn/', ws: true, changOrigin: true, //允许跨域 pathRewrite: { "^/v3": "/v3", //请求的时候使用这个api就可以 }, }, obpm: { // target: "https://v5qy.test.baibaodun.cn/", // target: "https://v5qy.te.baibaodun.com.cn", // target: 'http://49.4.123.194:37080/', //这里后台的地址模拟的;应该填写你们真实的后台接口192.168.88.192 // target: "http://v5qytl.test.baibaodun.cn/", target:'https://v5qy.baibaodun.cn/', // target:'http://v5gain.pre.baibaodun.cn/', // target: "https://v5qy.te.baibaodun.com.cn", ws: true, changOrigin: true, //允许跨域 pathRewrite: { "^/obpm": "/obpm", //请求的时候使用这个api就可以 }, }, kms: { // target: "https://v5qy.test.baibaodun.cn/", // target: "https://v5qy.te.baibaodun.com.cn", // target: 'http://49.4.123.194:37080/', //这里后台的地址模拟的;应该填写你们真实的后台接口 // target: "http://v5qytl.test.baibaodun.cn/", // target: "https://v5qy.te.baibaodun.com.cn", target:'https://v5qy.baibaodun.cn/', // target:'http://v5gain.pre.baibaodun.cn/', ws: true, changOrigin: true, //允许跨域 pathRewrite: { "^/kms": "/kms", //请求的时候使用这个api就可以 }, }, qms: { // target: "https://v5qy.test.baibaodun.cn/", target: "https://v5qy.te.baibaodun.com.cn", // target: 'http://49.4.123.194:37080/', //这里后台的地址模拟的;应该填写你们真实的后台接口 // target: "http://v5qytl.test.baibaodun.cn/", // target: "https://v5qy.te.baibaodun.com.cn", target:'https://v5qy.baibaodun.cn/', // // target:'http://v5gain.pre.baibaodun.cn/', ws: true, changOrigin: true, //允许跨域 pathRewrite: { "^/qms": "/qms", //请求的时候使用这个api就可以 }, }, message: { // target: "https://v5qy.test.baibaodun.cn/", target: "https://v5qy.te.baibaodun.com.cn", // target: 'http://49.4.123.194:37080/', // target: "http://v5qytl.test.baibaodun.cn/", // target: "https://v5qy.te.baibaodun.com.cn", target:'https://v5qy.baibaodun.cn/', // target:'http://v5gain.pre.baibaodun.cn/', ws: true, changOrigin: true, //允许跨域 pathRewrite: { "^/message": "/message", //请求的时候使用这个api就可以 }, }, seeyon: { // target: "https://v5qy.te.baibaodun.com.cn/", // target: "http://v5inmy.test.baibaodun.cn/", // target: "https://v5qy.te.baibaodun.com.cn", target:'https://v5qy.baibaodun.cn/', // target: 'http://123.121.155.161:801/', // target: "http://v5qytl.test.baibaodun.cn/", ws: true, changOrigin: true, //允许跨域 pathRewrite: { "^/seeyon": "/seeyon", //请求的时候使用这个api就可以 }, } }, }, };