2

Is there a way to limit the line length of the output file from webpack?

I'm building a javascript file for an environment with a 255 character line length limit, and the generated file has a line that is longer than that. This is part of webpack's bootstrap code, it's not from the input file.

I've looked at uglify-loader, but it does not seem to be updated to support webpack >= 2.

Ideally I'm looking for a solution that does not involve minifying the output, only splitting the lines that are too long.

1 Answer 1

3

Even though uglify-loader seems abandoned, uglifyjs-webpack-plugin did the trick.

The following config minifies the output, but at least the 255-character limit is respected.

plugins: [
    new UglifyJSPlugin({
      compress: true,
      output: {
        max_line_len: 255,
      },
    }),
]

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.