Nuxt3打包部署遇到Named export 'addListener' not found

  Nuxt3
  Echarts
3
0
1
字数:481
博主: 勤勇学
发布于: 2024-06-30 06:39:34
原创声明:文章所有权为创作者【原创】所有,未经许可,不得转载!

问题描述

Nuxt3打包部署后,访问出现

错误提示如下

Named export 'addListener' not found. The requested module 'resize-detector' is a CommonJS module, which may not support all module.exports as named exports. CommonJS modules can always be imported via the default export, for example using: import pkg from 'resize-detector'; const { addListener, removeListener } = pkg;

解决方式

在nuxt.config.ts中配置

因为我是在使用echart的时候,出现的,如果是其它模块依赖,可根据自己的依赖进行配置

build: {
  transpile: [/echarts/, "vue-echarts", 'resize-detector']
},