Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shakes out functions that I used #12

Open
Zae opened this issue Dec 29, 2017 · 6 comments
Open

shakes out functions that I used #12

Zae opened this issue Dec 29, 2017 · 6 comments
Labels

Comments

@Zae
Copy link

Zae commented Dec 29, 2017

I'm not sure if this plugin in production ready yet, but it seems that it removed functions that I'm definitely using.

Using import to get the modules, but running babel as a browserify transform, so that should rewrite everything to require.

seems that most of the incorrectly removed functions are from the crypto-browserify package.

@goto-bus-stop
Copy link
Member

Some of Babel's module transform output may be tripping up common-shake. Could you share an example that shows it failing?

@retail-robot
Copy link

Hi - I'm running into this issue too - I threw together a project that reproduces the issue here: https://github.com/retail-robot/common-shakeify-issue-12-repro

You should be able to clone it and just npm install + npm run build

@goto-bus-stop
Copy link
Member

Thanks @retail-robot! this is really hard to make work correctly in all situations, but that particular case should not be too difficult to support.

@Zae
Copy link
Author

Zae commented Apr 20, 2018 via email

@retail-robot
Copy link

np, @goto-bus-stop - thanks!

@toddself
Copy link

hi! we just ran into this too with the sbd library.

it is stripping out /lib/Match.js:isCaptialized, even though that function is called via this within the code.

09:42:00 ~/src/sbd:master
↳ npx browserify -p common-shakeify lib/tokenizer.js > shake.js
09:42:07 ~/src/sbd:master
↳ npx browserify lib/tokenizer.js > no-shake.js
09:45:03 ~/src/sbd:master
↳ grep isCapitalized shake.js
/* common-shake removed: exports.isCapitalized = */ void function(str) {
    return this.isCapitalized(str) || /``|"|'/.test(str.substring(0,2));
    return this.isCapitalized(str);
        if (wordCount < 5 && words[0].length < 6 && this.isCapitalized(words[0])) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants