babel-plugin-import-cnt
v1.0.0
Published
## Install
Downloads
10
Readme
babel-plugin-import-cnt
Install
npm install babel-plugin-import-cnt
and add it to your .babelrc.js
with babel-plugin-import-cnt
const cacheMap = {};
module.exports = {
plugins: ["import-cnt", {
before: (path, state) => {
// custom logic
if (xxx) {
path.stop();
}
},
cacheMap,
debug: true,
}]
}
Example
import { Button } from 'xxx-ui';
import { List, Foo } from 'antd';
export default () => {
return (
<div>
<Button />
<Button />
<List />
<List />
<Foo />
</div>
)
}
You can get the result cacheMap
{
"xxx-ui": {
"Button": 2,
"__total__": 1
},
"antd": {
"Foo": 1,
"List": 2,
"__total__": 1
}
}