added rollup-plugin-analyzer to retrieve useful information when building

This commit is contained in:
Roberto Tonino 2020-06-03 18:31:38 +02:00
parent e59ff93b1d
commit da657bbdcc
3 changed files with 11 additions and 2 deletions

6
package-lock.json generated
View File

@ -640,6 +640,12 @@
"acorn": "^7.1.0" "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": { "rollup-plugin-terser": {
"version": "5.3.0", "version": "5.3.0",
"resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.3.0.tgz", "resolved": "https://registry.npmjs.org/rollup-plugin-terser/-/rollup-plugin-terser-5.3.0.tgz",

View File

@ -26,6 +26,7 @@
"@rollup/plugin-replace": "^2.3.2", "@rollup/plugin-replace": "^2.3.2",
"npm-run-all": "^4.1.5", "npm-run-all": "^4.1.5",
"rollup": "^1.27.0", "rollup": "^1.27.0",
"rollup-plugin-analyzer": "^3.2.3",
"rollup-plugin-terser": "^5.0.0" "rollup-plugin-terser": "^5.0.0"
} }
} }

View File

@ -1,8 +1,9 @@
import resolve from '@rollup/plugin-node-resolve' import resolve from '@rollup/plugin-node-resolve'
import { terser } from 'rollup-plugin-terser'
import commonjs from '@rollup/plugin-commonjs' import commonjs from '@rollup/plugin-commonjs'
import replace from '@rollup/plugin-replace' import replace from '@rollup/plugin-replace'
import alias from '@rollup/plugin-alias' 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' -> 'production' is false
// 'rollup -c -w' -> 'production' is true // 'rollup -c -w' -> 'production' is true
@ -32,6 +33,7 @@ export default {
}), }),
resolve(), // Tells Rollup how to find imported modules in node_modules resolve(), // Tells Rollup how to find imported modules in node_modules
commonjs(), // Converts imported modules to ES modules, if necessary 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
] ]
} }