12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091 |
- const autoprefixer = require("autoprefixer");
- const pxtorem = require("postcss-pxtorem");
- const path = require('path');
- const themePath = path.resolve(__dirname,'src/assets/style/theme.less');
- const webpack = require('webpack');
- var os = require('os'), ip = '', ifaces = os.networkInterfaces() // 获取本机ip
- for (var i in ifaces) {
- for (var j in ifaces[i]) {
- var val = ifaces[i][j]
- if (val.family === 'IPv4' && val.address !== '127.0.0.1') {
- ip = val.address
- }
- }
- }
- module.exports = {
- // 关闭eslint检查
- lintOnSave: false,
- configureWebpack: {
- plugins: [
- new webpack.ProvidePlugin({
- $:"jquery",
-
- jQuery:"jquery",
- "windows.jQuery":"jquery"
- })
- ]
- },
- // 配置css前缀,px转rem
- css: {
- loaderOptions: {
- less: {
- modifyVars: {
- hack: `true; @import "${themePath}";`
- }
- },
- postcss: {
- plugins: [
- autoprefixer(),
- pxtorem({
- rootValue: 37.5,
- propList: ["*"]
- })
- ]
- }
- }
- },
- configureWebpack: {
- externals: {
- axios: "axios" // 配置使用CDN
- }
- },
- devServer: {
- open: true, //是否自动弹出浏览器页面
- port: '10087',
- https: false,
- hotOnly: false,
- //disableHostCheck: true,
- // 代理
- proxy: {
- '/wxcorp': {
- target: 'http://localhost:9099/',
- },
- '/api': {
- target: 'http://localhost:9099/',
- pathRewrite: { '^/api': '' }
- },
- '/upload': {
- target: 'http://localhost:8010/',
- pathRewrite: { '^/upload': '' }
- },
- // '/weixin': {
- // target: 'http://localhost:8001/'
- // }
- // // 只要请求地址有'api'都会匹配上
- // "/api": {
- // target: "http://"+ip+":2021",
- // ws: true,
- // // 允许跨域
- // changeOrigin: true,
- // pathRewrite: {
- // "^/api": "" //通过pathRewrite重写地址,将前缀/api转为/
- // }
- // }
- }
- }
- };
|