2.1.1 • Published 5 years ago
babel-plugin-remove-unused-import v2.1.1
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.parentPathif 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
- Supporting Scope