mizi-lin / hulujs

hulujs
MIT License
0 stars 0 forks source link

docs: vite build 问题集锦 #15

Open mizi-lin opened 11 months ago

mizi-lin commented 11 months ago

Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

初查原因说是因为 Top-Level Await 的错,需要添加插件包支持

https://tehub.com/a/aqNVCbFx4S

或 修改构建环境支持 Top Level Await

https://blog.csdn.net/weixin_65478269/article/details/129879368

hulu采用 target 方案

为什么不自动支持了,如发现系统支持,直接更换环境

mizi-lin commented 11 months ago

in "node_modules/react-helmet-async/lib/index.module.js" contains an annotation that Rollup cannot interpret due to the position of the comment. The comment will be removed to avoid issues.

node_modules/antd/es/card/Card.js (20:2) A comment

image
mizi-lin commented 11 months ago

Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

初查原因说是因为 Top-Level Await 的错,需要添加插件包支持

https://tehub.com/a/aqNVCbFx4S

或 修改构建环境支持 Top Level Await

https://blog.csdn.net/weixin_65478269/article/details/129879368

hulu采用 target 方案

为什么不自动支持了,如发现系统支持,直接更换环境


不支持 main.ts 文件 的 top level await

安装插件也不支持

https://www.npmjs.com/package/vite-plugin-top-level-await

mizi-lin commented 11 months ago

Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

初查原因说是因为 Top-Level Await 的错,需要添加插件包支持 https://tehub.com/a/aqNVCbFx4S 或 修改构建环境支持 Top Level Await https://blog.csdn.net/weixin_65478269/article/details/129879368 hulu采用 target 方案

为什么不自动支持了,如发现系统支持,直接更换环境

不支持 main.ts 文件 的 top level await

安装插件也不支持

https://www.npmjs.com/package/vite-plugin-top-level-await

并非不支持TopLevel Await, 而是 import 的文件也import , 嵌套 import 造成最外层 await import 失效