Closed matthewp closed 6 years ago
Shaves about 2k off of the bundle size.
cc @paulocoghi
Excellent!
Also, these removed kbs can make room for any new features without leaving the library larger than usual.
I have only one suggestion. In my opinion, it would be interesting to offer a minified version, page.min.js
, using rollup-plugin-uglify
, this way:
import commonjs from 'rollup-plugin-commonjs';
import nodeResolve from 'rollup-plugin-node-resolve';
import uglify from 'rollup-plugin-uglify';
import { minify } from 'uglify-es';
export default {
input: 'index.js',
output: {
file: 'page.min.js',
format: 'umd',
name: 'page'
},
plugins: [
nodeResolve({
jsnext: true,
main: true
}),
commonjs({
include: ['node_modules/**', '**']
}),
uglify( {}, minify )
]
};
The code above (for minified version) can reside in a new (additional) file rollup.config-min.js
, and in package.json
, you can change the "make" line to:
"make": "rollup -c rollup.config.js && rollup -c rollup.config-min.js"
@paulocoghi Let's discuss the minify idea in a new issue. I'd like to take some time to discuss it a bit and see what other libraries are doing these days (not sure if most are including a minified version or not. Does any include a gzipped version too?), and I don't want that to block this PR since it fixes issues like #458
BTW I opened #444 because it was not fully minified and I included page.js among other scripts for minification by closure compiler.
This switches to using rollup for the build. This fixes #444 among other things.