https://github.com/vladborsh/imports-sanitize
Stop blow up bundle size! Fix all non-tree-shakable imports with ease in a single command 🌟
https://github.com/vladborsh/imports-sanitize
cli imports lodash lodash-es npx treesha
Last synced: about 2 months ago
JSON representation
Stop blow up bundle size! Fix all non-tree-shakable imports with ease in a single command 🌟
- Host: GitHub
- URL: https://github.com/vladborsh/imports-sanitize
- Owner: vladborsh
- Created: 2020-06-09T18:03:03.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T20:41:10.000Z (over 3 years ago)
- Last Synced: 2026-05-08T09:51:30.457Z (2 months ago)
- Topics: cli, imports, lodash, lodash-es, npx, treesha
- Language: JavaScript
- Homepage:
- Size: 2.44 MB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Imports-sanitize
[](https://travis-ci.com/vladborsh/imports-sanitize)
[](https://coveralls.io/github/vladborsh/imports-sanitize?branch=master)
### Purposes
Fix your imports from lodash in source code to [tree-shakable](https://medium.com/@martin_hotell/tree-shake-lodash-with-webpack-jest-and-typescript-2734fa13b5cd) alternative
Source code before:
```typescript
import * as _ from 'lodash';
import { isEmpty, flatten } from 'lodash';
let i = isEmpty([]);
let x = flatten([]);
let j = _.isArray('');
```
Source code after:
```typescript
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
```bash
npx imports-sanitize -p ./src
```
### Supported packages
- ✅ lodash
- ✅ lodash-es