babel-plugin-component

整体引入:

Converts

  import Button from 'components'

to

  var button require('components/lib/button')
  require('components/lib/button/style.css')
 
按需引入:

Converts

  import Components from 'components'
  import Button from 'components'

to

  require('components/lib/styleLibraryName/index.css')
  var button require('components/lib/styleLibraryName/button.css')
 
1.installation
 
 npm i babel-plugin-component -D
 
2.usage: 
  在 .babelrc 中配置它:
{
  "plugins": ["other-plugin", ["component", [
    { "libraryName": "mint-ui", "style": true }
  ]]]
}

 

 
posted @ 2020-09-30 18:39  noraZhang  阅读(1556)  评论(0编辑  收藏  举报