Replies: 1 comment
-
const adapterFetch = adapterFetch();
const mockAdapter = createAlovaMockAdapter([mockGroup1, /** ... */], {
httpAdapter: adapterFetch,
delay: 1000,
});
export const alovaInst = createAlova({
baseURL: 'http://xxx',
// 通过环境变量控制生产环境下,不会将mock相关代码打包进去
requestAdapter: process.env.NODE_ENV === 'development' ? mockAdapter : globalFetch,
statesHook: /** ... */
}); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
enable 设置为 false,可以关闭 mock,但好像不能tree-shaking,毕竟小程序体积限制,能省一点是一点
Beta Was this translation helpful? Give feedback.
All reactions