1.2.3 • Published 1 year ago

babel-plugin-check-mutex-package v1.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
1 year ago

babel-plugin-check-mutex-package

检测重复功能的包,比如 bizcharts 和 echarts,moment 和 dayjs

Getting started

# 安装依赖
$ yarn add babel-plugin-check-mutex-package -D
// build.json:eg:
{
  babelPlugins: [
    + [babel-plugin-check-utils, { packages: [
    +  ['bizcharts', 'echarts'],
    +  ['moment', 'dayjs'],
    + ]}],
    [...other]
  ],
}

作用

  • 在使用了该插件后,在本地开发中如果检测到代码使用相同功能的包,则会进行警告处理

    // bad
    import moment from 'moment';
    import dayjs from 'dayjs';
    
    // good
    import moment from 'moment';
    or
    import dayjs from 'dayjs';
  • 如果使用不合理继续发布到生产环境,则会中断打包,无法发布到生产