Skip to content

Instantly share code, notes, and snippets.

@DragorWW
Created November 17, 2019 17:29
Show Gist options
  • Select an option

  • Save DragorWW/c54f5c78fd4c1f2f56ed88c1f73ef4b0 to your computer and use it in GitHub Desktop.

Select an option

Save DragorWW/c54f5c78fd4c1f2f56ed88c1f73ef4b0 to your computer and use it in GitHub Desktop.

Revisions

  1. DragorWW created this gist Nov 17, 2019.
    17 changes: 17 additions & 0 deletions import-stats.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,17 @@
    const fs = require('fs');

    // run `webpack --profile --json > compilation-stats.json` before this script
    const stats = require('./compilation-stats');

    fs.writeFileSync(
    'import-top.tsv',
    stats.modules
    .map(i => {
    return {
    name: i.name,
    count: i.reasons.length,
    };
    })
    .map(i => `${i.name}\t${i.count}`)
    .join('\n')
    );