agadoo icon indicating copy to clipboard operation
agadoo copied to clipboard

Improve error message when unable to resolve the main module

Open Kmaschta opened this issue 5 years ago • 1 comments

Kmaschta avatar Sep 07 '18 14:09 Kmaschta

You can improve this PR by adding a catch handler to the bin file. Should look like this:

require('./index.js')
  .check(input)
  .then(result => {
    const relative = path.relative(process.cwd(), input);

    if (result.shaken) {
      console.error(`Success! ${relative} is fully tree-shakeable`);
    } else {
      error(`Failed to tree-shake ${relative}`);
    }
  })
+  .catch(error);

adi518 avatar Jul 24 '20 15:07 adi518