We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No description provided.
The text was updated successfully, but these errors were encountered:
要在 umijs/mako 中配置接口代理(proxy),可以按照以下步骤进行:
安装 Mako: 首先,通过 npm 或 pnpm 安装 Mako。
$ npm i @umijs/mako -D
配置 Mako: 在你的项目配置文件中添加 mako 字段。你可以使用以下命令来设置:
mako
$ npx umi config set mako {}
这将在 .umirc.ts 或 config/config.ts 中生成以下配置:
.umirc.ts
config/config.ts
export default { + mako: {}, };
运行 Umi 项目: 现在,你可以使用 Mako 来运行 Umi 项目。
$ umi build
配置代理: 在 .umirc.ts 或 config/config.ts 中,你可以添加 proxy 配置来设置接口代理。例如:
proxy
export default { proxy: { '/api': { target: 'http://your-api-server.com', changeOrigin: true, pathRewrite: { '^/api': '' }, }, }, };
这样配置后,所有以 /api 开头的请求都会被代理到 http://your-api-server.com,并且路径中的 /api 会被移除。
/api
http://your-api-server.com
希望这个示例能帮助你配置接口代理。如果有其他问题,请随时问我。
Sorry, something went wrong.
proxy 和 mako 无关,不过你可以参考 bundler-mako 的方式实现,见 https://github.com/umijs/mako/blob/master/packages/bundler-mako/index.js#L108-L136 。
No branches or pull requests
No description provided.
The text was updated successfully, but these errors were encountered: