Keeps the lines of a production main.js short.
A minifier puts a whole bundle on a handful of lines, and the community directory’s release scanner warns that a main.js over 50 KB whose average line is over 20 000 characters is “unusually packed”, as deliberate packing to obstruct review would be. esbuild breaks its output at a line limit itself; the minifier each other adapter runs (oxc in vite, swc in parcel, terser in webpack) has no such option, so their output has its lines broken here after it is written.
| Function |
Description |
| limitLineLength |
Breaks the lines of a bundle that are longer than a line limit. A line is broken after the first , or ; token past the limit, and nothing else changes. A line terminator after either of them never changes what the code means: automatic semicolon insertion only acts where the next token could not continue, which in code that parses without the line break it can, and none of the productions that forbid a line terminator (after return, throw, break, continue and yield, before a postfix ++ / -- and before =>) has one of them on its left. The tokens come from a full parse, so a , or ; inside a string, a template or a regular expression is never taken for one. A bundle that references a source map is returned unchanged, since a line break would put the map out of step, and so is one that does not parse, with a warning. |
| limitMainJsLineLength |
Breaks the long lines of the main.js a production build wrote, through limitLineLength. |