jlengstorf / learn-rollup

This is an example project to accompany a tutorial on using Rollup.
https://code.lengstorf.com/learn-rollup-js/
ISC License
191 stars 61 forks source link

(uglify) WARN: Output exceeds 32000 characters #32

Closed guidorice closed 7 years ago

guidorice commented 7 years ago

Jason et al, I was experimenting with bundling some 3rd party css packages, and ran into this. To reproduce:

npm install material-design-lite --save
# add line to main.js
import '../../node_modules/material-design-lite/material.css';
# production build
export NODE_ENV=production
npm run build
> WARN: Output exceeds 32000 characters

The warning is coming from uglify, but I cannot figure out how or whether is possible to make postcss generate the injected styles with shorter line length. Just for background, this is an issue for both Js and Css files which is why uglify warns about it.

Why are there random line feeds in compiled scripts? The Closure Compiler intentionally adds line breaks every 500 characters or so. Firewalls and proxies sometimes corrupt or ignore large JavaScript files with very long lines. Adding line breaks every 500 characters prevents this problem. Removing the line breaks has no effect on a script's semantics. The impact on code size is small, and the Compiler optimizes line break placement so that the code size penalty is even smaller when files are gzipped. https://developers.google.com/closure/compiler/faq#linefeeds

jlengstorf commented 7 years ago

@guidorice Hey, thanks for reading! I think this issue would be better suited for https://github.com/postcss/postcss and/or https://github.com/mishoo/UglifyJS2 — this is a tutorial for Rollup, so I'm unable to offer much help with PostCSS/UglifyJS.

Good luck!