12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- // NOTE H5 端使用 devServer 实现跨域,需要修改 package.json 的运行命令,加入环境变量
- const isH5 = process.env.CLIENT_ENV === 'h5'
- const HOST = '"http://zhcq.jishutao.com"'
- const HOST_M = '"http://zhcq.jishutao.com"'
- // const HOST = '"http://172.16.0.255:8088"'
- // const HOST_M = '"http://172.16.0.255:8088"'
- module.exports = {
- env: {
- NODE_ENV: '"development"'
- },
- defineConstants: {
- // HOST: isH5 ? '"/api"' : HOST,
- HOST: isH5 ? '"http://zhcq.jishutao.com"' : HOST,
- // HOST: isH5 ? '"http://172.16.0.255:8088"' : HOST,
- HOST_M: isH5 ? '"/api-m"' : HOST_M
- },
- weapp: {},
- h5: {
- devServer: {
- proxy: {
- '/api/': {
- target: JSON.parse(HOST),
- pathRewrite: {
- '^/api/': '/'
- },
- changeOrigin: true
- },
- '/api-m/': {
- target: JSON.parse(HOST_M),
- pathRewrite: {
- '^/api-m/': '/'
- },
- changeOrigin: true
- }
- },
- host: "172.16.1.187",
- port: 8080,
- }
- }
- }
|