const path = require('path'); module.exports = { publicPath: './', devServer: { open: true, //是否自动弹出浏览器页面 proxy: { '/api': { target: 'http://101.133.238.90:8081', //API服务器的地址 pathRewrite: { '^/api': '/web/api', } }, }, }, css: { loaderOptions: { postcss: { plugins: [ require('postcss-pxtorem')({ rootValue: 37.5, // 换算的基数 selectorBlackList: ['weui', 'mu'], // 忽略转换正则匹配项 propList: ['*'], }), ] } } }, chainWebpack: (config) => { // 配置pug的 config.module.rule('pug') .test(/\.pug$/) .use('pug-html-loader') .loader('pug-html-loader') .end(); // 路径别名 config.resolve.alias .set('@',resolve('src')) .set('@com',resolve('src/components')) .set('@less',resolve('src/assets/less')) } } function resolve(dir) { return path.join(__dirname, dir); }