Skip to content

Instantly share code, notes, and snippets.

@DragorWW
Created November 17, 2019 17:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DragorWW/c54f5c78fd4c1f2f56ed88c1f73ef4b0 to your computer and use it in GitHub Desktop.
Save DragorWW/c54f5c78fd4c1f2f56ed88c1f73ef4b0 to your computer and use it in GitHub Desktop.
Get import statistics by webpack
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')
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment