重定向

This commit is contained in:
乘风
2026-02-03 19:17:05 +08:00
parent 0a57872f24
commit 4aed6d340a
3 changed files with 26 additions and 2 deletions

View File

@@ -199,6 +199,31 @@ resolve: {
## 运行时问题
### 0. TypeError: eval is not a function
**错误信息**
```
TypeError: eval is not a function
at Object../src/index.jsx (index.js?...)
```
**原因**`npm run mp` 使用 development 模式时webpack 默认 `devtool: 'eval'`,会注入使用 `eval()` 的代码;小程序环境**不支持** `eval`,因此报错。
**解决方案**:在 **webpack.mp.config.js** 中显式关闭 devtool
```javascript
module.exports = {
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development',
devtool: false, // 小程序环境不支持 eval必须关闭
entry: { ... },
// ...
}
```
重新执行 `npm run mp``npm run build:mp` 后,再在微信开发者工具中预览即可。
---
### 1. URLSearchParams 未定义
**错误信息**

1
newapp

Submodule newapp deleted from 5f9ae76b40

2
next-env.d.ts vendored
View File

@@ -1,6 +1,6 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
import "./.next/types/routes.d.ts";
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.