Rich-Harris / agadoo

Check whether a package is tree-shakeable
MIT License
535 stars 17 forks source link

How to handle external libraries? #3

Closed flekschas closed 4 years ago

flekschas commented 6 years ago

This is more of a question: I am wondering how external libraries can be handled? When the module I am testing imports some other external library like so:

import test from 'test';

The Rollup's code output contains that import statement (i.e., code: 'import \'test\';\n'). Hence, agadoo doesn't attest full shakability.

I guess my question is whether this is expected and if agadoo would just have to take this into account when testing for shakability or if something else needs to be adjusted.

billiegoose commented 5 years ago

Currently the definition of success is if calling rollup on

import ${JSON.stringify(resolved)}

results in an empty string.

What if we expanded the definition of success to be results in an empty string or a string containing ONLY external import statements?