重定向
This commit is contained in:
@@ -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
1
newapp
Submodule newapp deleted from 5f9ae76b40
2
next-env.d.ts
vendored
2
next-env.d.ts
vendored
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user