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
}
回答:
await
功能一般都是配合写在 async 函数
里的。
Top-level await 是个新特性,没有在你的 build target 里实现,所以会报错。
回答:
错误告诉你 Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
人家没骗你,看下图,真的不支持嘛
以上是 vite编译报错:not available in the configured target environment 的全部内容, 来源链接: utcz.com/p/935930.html