ElementUI / babel-plugin-component

Modular element-ui build plugin for babel.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

@babel/helper-module-imports 依赖版本问题

justyouhappy opened this issue · comments

提示isModuleDeclaration has been deprecated, please migrate to isImportOrExportDeclaration.

@babel/helper-module-imports 内部代码需要升级

function isUnambiguousModule(path) {
  return path.get("body").some(function (p) {
    return p.isModuleDeclaration();
  });
}

替换为

function isUnambiguousModule(path) {
  return path.get("body").some(function (p) {
    return p.isImportOrExportDeclaration();
  });
}

@babel/types的7.21版本内会warning提示替换api,7.21在2023.2.1发布的版本,新接入的项目会因为没有锁定type的小版本导至出现提示,麻烦官方大佬解决一下

commented

只能先强行 overrides @babel/helper-module-imports: ^7 来解决了. 内部写死了依赖7.0.0-beta.35
https://github.com/ElementUI/babel-plugin-component/blob/master/package.json#L57

旧项目尽早过度到 element-plus吧, 新项目的按需加载废弃了 babel-plugin-component.