babel-plugin-component icon indicating copy to clipboard operation
babel-plugin-component copied to clipboard

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

Open justyouhappy opened this issue 3 years ago • 2 comments

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

justyouhappy avatar Feb 21 '23 07:02 justyouhappy

@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的小版本导至出现提示,麻烦官方大佬解决一下

justyouhappy avatar Feb 21 '23 07:02 justyouhappy

只能先强行 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.

yoyo837 avatar Feb 21 '23 08:02 yoyo837