Rich-Harris / agadoo

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

Strip comments #1

Open rstacruz opened 6 years ago

rstacruz commented 6 years ago

This is a very interesting concept!

It seems to report some modules as "Failed to treeshake" because, they will include some comments:

/* global HTMLElement */

// @flow

// @flow

Failed to tree-shake index.js

This example in particular is pretty common. If I use this file, the comment will be printed out:

/*
 * I am a comment that will be included.
 */

export function xyz () {
  // ...
}
funkybob commented 6 years ago

I've noticed, also, that it's only comments starting on the very first line of a file. I inserted a blank line at the start of the files, and the comments were stripped.