Browse Source

feat(app): 开发模式下将 MSW 未处理请求策略从 bypass 改为 error

dengdx 5 days ago
parent
commit
594efe843d
1 changed files with 2 additions and 1 deletions
  1. 2 1
      src/app.tsx

+ 2 - 1
src/app.tsx

@@ -22,8 +22,9 @@ if (process.env.NODE_ENV === 'development' && process.env.USE_MSW === 'true') {
   import('../mocks/server')
     .then(({ server }) => {
       server.start({
-        onUnhandledRequest: 'bypass', // Ignore unhandled requests
+        onUnhandledRequest: 'error', // 未处理的请求触发网络错误
       });
+      console.log(`启动了MSW`);
     })
     .catch((err) => {
       console.warn('Mock server module not found:', err);