babel-plugin-remove-unused-import
v2.1.1
Published
> Fork from babel-plugin-danger-remove-unused-import
Downloads
134
Maintainers
Readme
babel-plugin-remove-unused-import
Fork from babel-plugin-danger-remove-unused-import
Fork Changes
visitor.Program.enter
->visitor.Program.exit
: make sure this plugin comes in after minify-dead-code-elimination.- remove import
binding.path.parentPath
if not referenced, ignoring side effects. - rename package to
babel-plugin-remove-unused-import
.
For shrinking the bundled javascript size :smile:
Note: remove unused import is dangerous because the imported package may have some side effects!
Option
{
ignore: ['react']
}
Input
import React from 'react'
import Button from 'button'
import _ from 'lodash'
import moment from 'moment'
import { data } from '../some-where'
// ...
const a = {}
a.moment = <Button x={data} />
Output
import React from 'react'
import Button from 'button'
- import _ from 'lodash'
- import moment from 'moment'
import {data} from '../some-where'
// ...
const a = {}
a.moment = <Button x={data} />
Todo
- [x] Supporting Scope