yarn add babel-plugin-import-slim --dev
Via .babelrc.js
or babel-loader.
{
"plugins": [["import-slim", 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
}
},
]
import { Select as BeeSelect, Pagination, DatePicker } from '@dp/bee-ui';
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';
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"]
}