报错信息

 error during build:
    Error: Transform failed with 1 error:
   assets/alarmStrategy-!~{00m}~.js:315:12: ERROR: Top-level await is not available in the    configured target environment ("chrome87", "edge88", "es2020", "firefox78", "safari14" + 2 overrides)

解决方案 :在vite.config.js中添加以下代码

export default defineConfig({
  plugins: [vue()],
  build:{
    target:['edge90','chrome90','firefox90','safari15']
  }
}

主要代码 打包错误在 build { }里面添加 

target: ['edge90', 'chrome90', 'firefox90', 'safari15'],
或者
build: {
    target: "es2019",
}
或者

build: {
    target: "esnext",
}

Logo

前往低代码交流专区

更多推荐