Bundle name | Parsing size (without gzip, KB) | Download size (with gzip, in KB) |
---|---|---|
Original | 193 | 42 |
Minified (terser) | 64 | 19 |
Production (replace process.env.NODE_ENV ) |
143 | 34 |
Minified + Production (terser + replace process.env.NODE_ENV ) |
38 | 13 |
Last active
February 12, 2020 17:28
-
-
Save pmdartus/f97b7895c39b66069365738c9ea7c65c to your computer and use it in GitHub Desktop.
Rollup configuration for size comparison
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Run via `yarn rollup -c rollup.config.js` at the root of the lwc repo | |
import path from 'path'; | |
import replace from '@rollup/plugin-replace'; | |
import { terser } from 'rollup-plugin-terser'; | |
const input = path.resolve(__dirname, 'packages/lwc/dist/engine/esm/es2017/engine.js'); | |
const replaceConfig = { | |
'process.env.NODE_ENV': JSON.stringify('production'), | |
}; | |
const terserConfig = { | |
output: { | |
comments: false, | |
} | |
}; | |
export default [ | |
{ | |
input, | |
output: { | |
file: 'dist/original.js', | |
}, | |
}, | |
{ | |
input, | |
plugins: [replace(replaceConfig)], | |
output: { | |
file: 'dist/prod.js', | |
}, | |
}, | |
{ | |
input, | |
plugins: [terser(terserConfig)], | |
output: { | |
file: 'dist/minified.js', | |
}, | |
}, | |
{ | |
input, | |
plugins: [replace(replaceConfig), terser(terserConfig)], | |
output: { | |
file: 'dist/prod-minified.js', | |
}, | |
}, | |
]; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment