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') );