Top-level await 是个新特性,打包不支持此特性。 解决方案: 1.安装vite-plugin-top-level-await插件 yarn add vite-plugin-top-level-await -D 2.vite.config.js中配置 import topLevelAwait from 'vite-plugin-top-level-await'plugins:[ topLevelAwait({ promiseExportName:'__tla', promiseImportName: (i...
vite 打包报了一个错: Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2019”, “firefox78”, “safari13.1”) 一、错误原因 「ECMAScript」提案 Top-level await 由 Myles Borins 提出,它可以让你在模块的最高层中使用 await 操作符。在这之前,...
原因:vite 不支持顶级的 async/await 语法,需要安装插件做兼容 解决方案: vite.config.ts 安装并引入 topLevelAwait npm install vite-plugin-top-level-await -D // vite.config.ts 文件 // 解决 vite build打包报错Top-level await is not available importtopLevelAwaitfrom'vite-plugin-top-level-await'expo...
一、错误原因 最高层中不让使用 await 二、解决方案 1.引入vite-plugin-top-level-await npm install vite-plugin-top-level-await-D 2.在vite.config.js配置此插件 importtopLevelAwaitfrom'vite-plugin-top-level-await'exportdefaultdefineConfig({plugins:[topLevelAwait({// The export name of top-level ...
在用vite2 + vue3 + elementplus开发时,vite2 打包报了一个错: Top-level await is not available in the configured target environment (“chrome87”, “edge88”, “es2019”, “firefox78”, “safari13.1”) 一、错误原因 「ECMAScript」提案 Top-level await 由 Myles Borins 提出,它可以让你在模块...
Describe the bug Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1") "scripts": { "dev": "vite", "build": "vue-tsc --noEmit && vite build", "build:debug": "vue...
After upgrading to Remix with Vite I was getting this error: ✘ [ERROR] Top-level await is not available in the configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides) ../../node_modules/.pnpm...
ERROR: Top-level await is not available in the configured target environment这是因为依赖到了浏览器的top-level-await特性,当设置的浏览器环境不支持该特性时就会出现该报错,解决办法是将build.target设置为esnext,你可以在这里查看各个浏览器对该特性的支持情况。
Top-level-await是一个新的es功能,在旧的浏览器中无法运行。如果你相信你的用户使用的是相对较新的...
constmyWorker=import.meta.env.DEV// In development mode, `import`s in workers are not transformed, so you// must use `{ type: "module" }`.?newWorker(newURL("./my-worker.js",import.meta.url),{type:"module"})// In build mode, let Vite and vite-plugin-top-level-await build a ...