This repository has been archived by the owner on Mar 7, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
配置接口代理 #1116
Labels
Comments
const less = require('@remax/plugin-less');
const CopyPlugin = require('copy-webpack-plugin');
module.exports = {
one: true,
output: 'dist/' + process.env.REMAX_PLATFORM,
plugins: [less()],
configWebpack({ config }) {
// https://github.com/neutrinojs/webpack-chain
// node_modules\@remax\cli\lib\build\web.js
config.devServer.proxy({
'/api': {
target: 'https://xxxx.com',
changeOrigin: true
// pathRewrite: { "^/api": "" } // 匹配 api 将 api 替换为 空
}
});
// 详细配置参考 copy-webpack-plugin
config
.plugin('copy')
.use(CopyPlugin, [[{ from: 'src/images', to: 'images' }]]);
}
}; config.devServer.proxy 这段应该没问题吧? |
@xd199153 就是这样 |
我是说我这样配不生效~ 现在只能改node_modules里面的代码 |
知道了,因为我们配了 historyApiFallback |
noyobo
added a commit
that referenced
this issue
Jul 9, 2020
yesmeck
pushed a commit
that referenced
this issue
Jul 9, 2020
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
需求描述
我是开发web端,接口跨域了,需要配置一下prxoy。
通过
configWebpack
的webpack-chain
实例配置config.devServer.proxy
无效。解决方案
现在我是直接改的
node_modules\@remax\cli\lib\build\web.js
,临时用用。希望能直接使用config.devServer.proxy配置
其他信息
The text was updated successfully, but these errors were encountered: