umijs / dumi

📖 Static Site Generator for component library development
https://d.umijs.org
MIT License
3.61k stars 1.18k forks source link

bug: 使用 axios 报错 util.TextEncoder is not a constructor #2183

Closed crazyair closed 3 months ago

crazyair commented 3 months ago

Version

latest

OS Version

mac

Node.js Version

latest

Browser Version

chrome

Link to minimal reproduction

https://github.com/crazyair/dumi-test/tree/codesandbox

Steps to reproduce

打开 http://localhost:8001/guide

What is expected?

不报错

What is actually happening?

TypeError: util.TextEncoder is not a constructor

Any additional comments? (optional)

No response

PeachScript commented 3 months ago

@Jinbao1001 cc

chaomingd commented 3 months ago

遇到同样的问题,该问题 再 2.3.x 出现的,2.2.x没有问题 似乎是模块路径解析的不对,应该导入的是 axios/dist/browser/axios.cjs 但导入了axios/dist/node/axios.cjs image image

Jinbao1001 commented 3 months ago

closed #2187