luwes / rollup-plugin-size

🍣 Track compressed Rollup asset sizes over time.
65 stars 4 forks source link

options gets overwrite in case of multiple instances of rollup-plugin-size #6

Closed kuldeepkeshwar closed 4 years ago

kuldeepkeshwar commented 4 years ago

rollup-plugin-size uses below code to extend default options check here

const coreOptions = Object.assign(defaults, options);

In case of multiple instance of rollup-plugin-size, the options gets overwritten by the last instance's option.

e.g rollup.config.js

import size from 'rollup-plugin-size';
import pkg from './package.json'

export default [
  {
    input: 'src/index.js',
    output: {
      file: 'dist/index.js'
      format: 'cjs',
    },
    plugins: [ size({filename:'sizes-cjs.json'})],
  },
  {
    input: 'src/index.js',
    output: {
      file: 'dist/index.es.js'
      format: 'es',
    },
    plugins: [ size({filename:'sizes-es.json'})],
  },
]

above configuration only create sizes-es.json file, ideally, it should create both(sizes-es.json & sizes-cjs.json) files