Skip to content

Instantly share code, notes, and snippets.

@jprivillaso
Created December 10, 2017 20:46
Show Gist options
  • Save jprivillaso/deb8f6f28f487adb076447008b7406c3 to your computer and use it in GitHub Desktop.
Save jprivillaso/deb8f6f28f487adb076447008b7406c3 to your computer and use it in GitHub Desktop.
const generateWebpackStats = (info, webpackProcessName) => {
const fs = require('fs');
const dir = path.resolve(__dirname, '../../stats');
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir);
}
const fileName = `../../stats/${webpackProcessName}-stats.json`;
fs.writeFile(path.resolve(__dirname, fileName), JSON.stringify(info), (err) => {
if(err) {
console.log(err);
} else {
console.log(`${webpackProcessName}-stats.json were saved successfully!`);
}
});
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment