question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Legal comments are no longer kept in bundle

See original GitHub issue

Bug report

Describe the bug

Previous versions of Next.js (at lest v7.x) included legal comments in the commons.js bundle:

(window.webpackJsonp=window.webpackJsonp||[]).push([[0], /* ... */
/*!
 * The buffer module from node.js, for the browser.
 *
 * @author   Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
 * @license  MIT
 */
...

In v9.0.x and v9.2.x, those legal comments are now stripped out:

(window.webpackJsonp=window.webpackJsonp||[]).push([[0] /* ... */

To Reproduce

  1. next build && next export
  2. Serve files locally (e.g. npx http-serve out -p 3000)
  3. Browse generated assets in the devtools (commons-xxxx.js in particular).

Expected behavior

Legal comments should be kept in the bundle, and I believe that’s the default webpack configuration.

Screenshots

See snippets above.

System information

  • OS: macOS
  • Browser (if applies) Chrome v79
  • Version of Next.js: v9.2 (vs v7.x)

Thanks for looking into this!

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
paulcnicholscommented, Feb 19, 2020

Is there a best practice about where to put this license file or how to make it discoverable to anyone concerned?

1reaction
timneutkenscommented, Jan 19, 2020

We mirror create-react-app’s behavior here.

The comments are of no actual use in production bundles as the original code is not preserved (minified) and the comment as is covers the full file because everything is minified, which is incorrect. Instead you should compile a list of license files from all npm deps that you have, not just the ones with comments. You can use something like: https://www.npmjs.com/package/npm-license-crawler.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unable to strip comments in webpack bundle js file
UglifyJsPlugin don't remove @licence comments even if you set comments: false for legal reasons. You can read about it on webpack GitHub issue....
Read more >
ANOTHER COMMENT ON BUNDLES: TOO MUCH AND TOO ...
More on Bundles: there is much time and money to be saved yet. Lengthy bundles and interim costs. Get bundles and skeletons to...
Read more >
Why Do Firms Bundle And Tie? Evidence From Competitive ...
The law presumes that tying allows a firm to leverage market power from one good to another. But tying is a common practice...
Read more >
THE BLUEBOOK MADE EASY - Penn State Law
Bluebook citation is used by most law reviews and journals, ... Abbreviate other words of 8 letters or more if substantial space is...
Read more >
Attorney Advertising, Solicitation, and Professional Notices
A lawyer may write for publication on legal topics (or speak publicly) without affecting the right to accept employment so long as the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found