luwes / rollup-plugin-size

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

Saving filesizes to disk doesn't happen #8

Open carhartl opened 4 years ago

carhartl commented 4 years ago

I can see there's an option writeFile and it is set to true by default, and a file named size-plugin.json should appear where sizes are being written to. Such a file never appears for me and when I rollup my sources (without the watch option) it always looks like there were no changes to last run:

Screenshot 2019-12-12 at 10 38 57

I tested in Nodejs 12.10.0 as well as 13.2.0.

Here's an excerpt of my rollup config (I have tried to specify an explicit file name there, but both relying on the default and using an explicit file name fail):

export default [
  {
    input: 'src/api.mjs',
    output: [
      // config for <script type="module">
      {
        file: pkg.module,
        format: 'esm'
      },
      // config for <script nomodule>
      {
        file: pkg.browser,
        format: 'umd',
        name: 'Cookies',
        noConflict: true,
        banner: ';'
      }
    ],
    plugins: [licenseBanner]
  },
  {
    input: 'src/api.mjs',
    output: [
      // config for <script type="module">
      {
        file: pkg.module.replace('.mjs', '.min.mjs'),
        format: 'esm'
      },
      // config for <script nomodule>
      {
        file: pkg.browser.replace('.js', '.min.js'),
        format: 'umd',
        name: 'Cookies',
        noConflict: true
      }
    ],
    plugins: [
      terser(),
      licenseBanner, // must be applied after terser, otherwise it's being stripped away...
      size({ filename: 'sizes-min.json' })
    ]
  }
]
carhartl commented 4 years ago

Is there something like a debug or verbose option? I suspect the file cannot be written for some reason..