From 9b7aeceeef62b94fbf988fa3e0e1045986ddf1f5 Mon Sep 17 00:00:00 2001 From: Paul D'Ambra Date: Tue, 23 Jul 2024 20:44:03 +0100 Subject: [PATCH] chore: fix the rollup bundle visualiser output (#1315) --- .gitignore | 1 + rollup.config.js | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index 6f9a2cca0..f1cb33f9a 100644 --- a/.gitignore +++ b/.gitignore @@ -27,5 +27,6 @@ react/dist test-result.json yarn-error.log stats.html +bundle-stats*.html .eslintcache cypress/downloads/downloads.html \ No newline at end of file diff --git a/rollup.config.js b/rollup.config.js index 729fd6946..e2ca5932e 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -18,14 +18,14 @@ const plugins = [ presets: ['@babel/preset-env'], }), terser({ toplevel: true }), - visualizer(), ] /** @type {import('rollup').RollupOptions[]} */ const entrypoints = fs.readdirSync('./src/entrypoints').map((file) => { const fileParts = file.split('.') - const extension = fileParts.pop() + // pop the extension + fileParts.pop() let format = fileParts[fileParts.length - 1] // NOTE: Sadly we can't just use the file extensions as tsc won't compile things correctly @@ -37,6 +37,8 @@ const entrypoints = fs.readdirSync('./src/entrypoints').map((file) => { const fileName = fileParts.join('.') + // we're allowed to console log in this file :) + // eslint-disable-next-line no-console console.log(`Building ${fileName} in ${format} format`) return { input: `src/entrypoints/${file}`, @@ -56,7 +58,7 @@ const entrypoints = fs.readdirSync('./src/entrypoints').map((file) => { ...(format === 'cjs' ? { exports: 'auto' } : {}), }, ], - plugins: [...plugins], + plugins: [...plugins, visualizer({ filename: `bundle-stats-${fileName}.html` })], } })