doesdev / rollup-plugin-analyzer

Mad metrics for your rollup bundles, know all the things

Home Page:http://rollup-plugin-analyzer.doesdev.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Not working with several outputs

politician opened this issue · comments

I have several outputs (non-minified and minified version)

plugins: [
    multi(),
    externals(iifeExternalsConfig),
    resolve({ extensions }),
    commonjs(),
    babel(iifeBabelConfig),
    analyze(),
  ],
output: [
    // One file bundle
    {
      file: pkg.browser,
      name: exportName,
      format: 'iife',
      globals: iifeExternals,
      sourcemap: process.env.BUILD === 'production' ? false : true,
      sourcemapExcludeSources: true,
    },
    // Minified bundle
    {
      file: pkg.unpkg,
      name: exportName,
      format: 'iife',
      globals: iifeExternals,
      sourcemap: process.env.BUILD === 'production' ? false : true,
      sourcemapExcludeSources: true,
      plugins: [terser()],
    },
  ],

I get the following:

-----------------------------
Rollup File Analysis
-----------------------------
bundle size:    68.771 KB
original size:  123.56 KB
code reduction: 44.34 %
module count:   79

...

-----------------------------
Rollup File Analysis
-----------------------------
bundle size:    68.771 KB
original size:  123.56 KB
code reduction: 44.34 %
module count:   79

Here are my files:

% ls -l dist/iife       
-rw-r--r--  1 romain  staff  71206 Jul  9 18:04 index.js
-rw-r--r--  1 romain  staff  22280 Jul  9 18:04 index.min.js

The second Rollup File Analysis should show a bundle size of 21.758 KB

As mentioned in the other ticket, this module reports on the code at the state in it's lifecycle once resolved and tree-shaken, but before minification, compression, other post-processing. I'm going to close this but have pinned the other issue to provide that context for others and will add it to the Readme as well

The mentioned ticket is #21