Skip to content

hudingyu/babel-plugin-import-slim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GitHub issues GitHub forks GitHub stars GitHub license

babel-plugin-import-slim

Usage

yarn add babel-plugin-import-slim --dev

Via .babelrc.js or babel-loader.

{
  "plugins": [["import-slim", options]]
}

options

options can be object.

{
  "libraryName": "bee-ui",
  "camel2DashComponentName": true,  // default: false
  "customSourceFunc": (name) => {
       // something
  }
}

or

{
  "libraryName": "bee-ui",
  "camel2UnderlineComponentName": true,  // default: false
  "customSourceFunc": (name) => {
        // something
   }
}

options can be array.

[
    {
      "libraryName": "bee-ui",
      "camel2UnderlineComponentName": true,
      "customSourceFunc": (name) => {
            // something
       }
    },
    {
      "libraryName": "moma-ui",
      "camel2UnderlineComponentName": true,
      "customSourceFunc": (name) => {
            // something
       }
    },
]

Example

From

import { Select as BeeSelect, Pagination, DatePicker } from '@dp/bee-ui';

To

import BeeSelect from '@dp/bee-ui/src/components/ui-base/select/select';
import Pagination from '@dp/bee-ui/src/components/ui-base/pagination/pagination';
import DatePicker from '@dp/bee-ui/src/components/ui-base/date-picker/date-picker';

Notes

If you want to use this plugin via .babelrc, it should be configured in .babelrc.js. And .babelrc should be like this:

{
  "presets": ["./.babelrc.js"]
}

About

babel plugin for demand import

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published