vladborsh / imports-sanitize

Stop blow up bundle size! Fix all non-tree-shakable imports with ease in a single command 🌟

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Imports-sanitize

Build Status Coverage Status

Purposes

Fix your imports from lodash in source code to tree-shakable alternative

Source code before:

import * as _ from 'lodash';
import { isEmpty, flatten } from 'lodash';

let i = isEmpty([]);
let x = flatten([]);
let j = _.isArray('');

Source code after:

import isEmpty from 'lodash/isEmpty';
import flatten from 'lodash/flatten';
import isArray from 'lodash/isArray';

let i = isEmpty([]);
let x = flatten([]);
let j = isArray('');

How to use

Just run single command in your project terminal. -p parameter is a your source code folder path

npx imports-sanitize -p ./src

Supported packages

  • βœ… lodash
  • βœ… lodash-es

About

Stop blow up bundle size! Fix all non-tree-shakable imports with ease in a single command 🌟


Languages

Language:JavaScript 74.0%Language:TypeScript 26.0%