vite编译报错:not available in the configured target environment
[vite:esbuild-transpile] Transform failed with 1 error:
assets/index.38819d44.js:2172:0: error: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
2169| });
2170| setupStore(app);
2171| app.use(router).use(useElementPlus).use(usI18n);
| ^
2172| await router.isReady();
| ^
2173| app.mount("#app");
error during build:
Error: Transform failed with 1 error:
assets/index.38819d44.js:2172:0: error: Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
at failureErrorWithLog (C:\Users\12976\vue\my-admin\node_modules\esbuild\lib\main.js:1449:15)
at C:\Users\12976\vue\my-admin\node_modules\esbuild\lib\main.js:1260:29
at C:\Users\12976\vue\my-admin\node_modules\esbuild\lib\main.js:609:9
at handleIncomingPacket (C:\Users\12976\vue\my-admin\node_modules\esbuild\lib\main.js:706:9)
at Socket.readFromStdout (C:\Users\12976\vue\my-admin\node_modules\esbuild\lib\main.js:576:7)
at Socket.emit (events.js:375:28)
at Socket.emit (domain.js:470:12)
at addChunk (internal/streams/readable.js:290:12)
at readableAddChunk (internal/streams/readable.js:265:9)
at Socket.Readable.push (internal/streams/readable.js:204:10)
at Pipe.onStreamRead (internal/stream_base_commons.js:188:23)
在vite.config.ts的加上下面这个也不行
build: {
target: "es2019",
brotliSize: false,
chunkSizeWarningLimit: 2000
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
await
功能一般都是配合写在async 函数
里的。Top-level await 是个新特性,没有在你的 build target 里实现,所以会报错。
错误告诉你
Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
人家没骗你,看下图,真的不支持嘛