UNPKG

rollup-plugin-webpack-stats

Version:

Rollup/Vite/Rolldown plugin to generate a stats JSON file with a bundle-stats webpack-compatible structure

20 lines (18 loc) 665 B
const require_runtime = require('./_virtual/_rolldown/runtime.cjs'); let node_path = require("node:path"); node_path = require_runtime.__toESM(node_path); let node_fs_promises = require("node:fs/promises"); node_fs_promises = require_runtime.__toESM(node_fs_promises); //#region src/write.ts async function statsWrite(filepath, stats) { const content = JSON.stringify(stats, null, 2); await node_fs_promises.default.mkdir(node_path.default.dirname(filepath), { recursive: true }); await node_fs_promises.default.writeFile(filepath, content); return { filepath, content }; } //#endregion exports.statsWrite = statsWrite; //# sourceMappingURL=write.cjs.map