browserify / browserify/common-shakeify

does not remove imports that belongs to dead code which is removed by common-shake

Open
#19 1 comment 0 reactions 0 assignees View on GitHub
limitation
Dominant language
JavaScript
Stars
103
Forks
8
PR merge metrics
No merged PRs in 30d

Description

Thanks for the efforts. This plugin works great. I will try to explain the case i came across.

"index.es6" imports {Storage} from "abc" which intern import {Cookie} from "xyz".
"abc" is using {Cookie} from "xyz". But Index.es6 is not using {Storage} from "abc". Now common-shake is removing {Storage} from the code but {Cookie} remains in the output file. If I remove reference to {Cookie} from abc then common-shake is removing {Cookie} as well.

Here is the file structure

index.es6

```
import {Storage} from "./abc";
console.log("this is an example");
```

abc.es6

```
import {Cookie} from "./xyz";

export var Storage = function(){
}
Storage.prototype = {
getCookie: function(){
let cookie = new Cookie(); // if i remove this line then common-shake removes Cookie from the output
}
}
```

xyz.es6

```
export var Cookie= function(){
}

Cookie.prototype = {
readCookie: function(){
console.log("reading cookie");
}
}
```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.