Skip to content

Commit

Permalink
Remove whitespaces and comments from the browser bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
omgovich committed Mar 10, 2021
1 parent 10ac712 commit 2799622
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
101 changes: 101 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@
"pngjs": "^6.0.0",
"prettier": "^2.2.1",
"rollup": "^2.39.0",
"rollup-plugin-terser": "^7.0.2",
"tar-stream": "^2.2.0",
"typescript": "^4.2.2"
},
Expand Down
8 changes: 8 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { nodeResolve } from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';
import json from '@rollup/plugin-json';
import { terser } from 'rollup-plugin-terser';

export default {
input: './lib/svgo.js',
Expand Down Expand Up @@ -31,5 +32,12 @@ export default {
nodeResolve({ browser: true, preferBuiltins: false }),
commonjs(),
json(),
// Whitespaces and comments removal makes the browser bundle lighter
// while retaining the ability to debug errors
terser({
compress: false,
mangle: false,
format: { comments: false },
}),
],
};

0 comments on commit 2799622

Please sign in to comment.