doesdev / rollup-plugin-analyzer

Mad metrics for your rollup bundles, know all the things
http://rollup-plugin-analyzer.doesdev.com
MIT License
242 stars 4 forks source link

Not working with several outputs #22

Closed politician closed 4 years ago

politician commented 4 years ago

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

doesdev commented 4 years ago

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

politician commented 4 years ago

The mentioned ticket is #21