From da657bbdcc1bb61938f0392f77cd170d632847df Mon Sep 17 00:00:00 2001 From: Roberto Tonino Date: Wed, 3 Jun 2020 18:31:38 +0200 Subject: [PATCH] added rollup-plugin-analyzer to retrieve useful information when building --- package-lock.json | 6 ++++++ package.json | 1 + rollup.config.js | 6 ++++-- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9a0d737..fcd00f1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -640,6 +640,12 @@ "acorn": "^7.1.0" } }, + "rollup-plugin-analyzer": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/rollup-plugin-analyzer/-/rollup-plugin-analyzer-3.2.3.tgz", + "integrity": "sha512-Oq5GtofTCIGhW4mDNtnxH106gvPKQcdAKTLujWekAiLiTmstXX9Fmye7uMG7NaZVBHgKPPsIWCtPj04ci/YXmg==", + "dev": true + }, "rollup-plugin-terser": { "version": "5.3.0", "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.3.0.tgz", diff --git a/package.json b/package.json index 11ffa37..8b67a98 100644 --- a/package.json +++ b/package.json @@ -26,6 +26,7 @@ "@rollup/plugin-replace": "^2.3.2", "npm-run-all": "^4.1.5", "rollup": "^1.27.0", + "rollup-plugin-analyzer": "^3.2.3", "rollup-plugin-terser": "^5.0.0" } } diff --git a/rollup.config.js b/rollup.config.js index 32a6495..f1910d1 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,8 +1,9 @@ import resolve from '@rollup/plugin-node-resolve' +import { terser } from 'rollup-plugin-terser' import commonjs from '@rollup/plugin-commonjs' import replace from '@rollup/plugin-replace' import alias from '@rollup/plugin-alias' -import { terser } from 'rollup-plugin-terser' +import analyze from 'rollup-plugin-analyzer' // 'rollup -c' -> 'production' is false // 'rollup -c -w' -> 'production' is true @@ -32,6 +33,7 @@ export default { }), resolve(), // Tells Rollup how to find imported modules in node_modules commonjs(), // Converts imported modules to ES modules, if necessary - production && terser() // Minify, but only in production + production && terser(), // Minify, but only in production + production && analyze({ showExports: true }) // Show useful information about bundles, only in production ] }