PubTrivia is a Next.js app with 50 direct dependencies: 33 runtime and 17 development. That is a deliberately boring list. pnpm licenses list disagrees about the size of the problem:
$ pnpm licenses list --json | jq 'to_entries | map({licence: .key, n: (.value | length)}) | sort_by(-.n)'
| licence | packages |
|---|---|
| MIT | 511 |
| Apache-2.0 | 36 |
| ISC | 22 |
| BSD-2-Clause | 11 |
| BSD-3-Clause | 8 |
| BlueOak-1.0.0 | 5 |
| MPL-2.0 | 3 |
| FSL-1.1-MIT | 2 |
| Unlicense | 2 |
| LGPL-3.0-or-later | 1 |
| CC-BY-4.0 | 1 |
| CC0-1.0 | 1 |
| 0BSD | 1 |
| MIT-0 | 1 |
| (MPL-2.0 OR Apache-2.0) | 1 |
| (MIT AND Zlib) | 1 |
| (MIT OR CC0-1.0) | 1 |
608 rows, 606 distinct package names, 17 distinct licence expressions, 31 packages installed at more than one version, 8,717 lines of lockfile, and 1.1 GB in node_modules. 84 per cent of it is MIT and I am not going to pretend to have read any of it.
What I did read is the short tail, because the short tail is where the interesting rows are, and because almost none of what is in that table is actually shipped to anybody.
The thing we deploy has 23 dependencies
Our live game runs on a second service in the same repository, a WebSocket server deployed as a container. It is the only artefact we build and hand to a host:
$ pnpm licenses list --json --filter ws-server
| licence | packages |
|---|---|
| MIT | 17 |
| Apache-2.0 | 5 |
| Unlicense | 1 |
Twenty-three packages, three licences, four direct dependencies. The 608-row table is the laptop's problem. This is the deployment's problem, and it would fit on an index card.
The single Unlicense row in both tables is the same package: postgres@3.4.9, the driver holding every database connection this product makes. The Unlicense is a public domain dedication, so the most load-bearing dependency we have is the one with no conditions attached at all. It is also the one with the fewest people to thank.
The short tail, traced
pnpm why turns each odd row into a sentence.
LGPL-3.0-or-later: @img/sharp-libvips-darwin-arm64@1.2.4. This is the native image library behind sharp, which arrives under next. The row says darwin-arm64, which means this particular copy exists only on my Mac. Nothing we deploy contains it, and the Linux build downloads its own. An LGPL row in a licence report that disappears if someone else runs the install on a different machine is a good argument for auditing the lockfile rather than the directory.
FSL-1.1-MIT twice: @sentry/cli and its darwin binary. The Functional Source License is not an open source licence. It is "source available now, MIT in two years", designed to stop competitors reselling the tool. It is in our tree because we upload source maps at build time. A build tool rather than a shipped library, which is the only reason it does not need a decision.
MPL-2.0 three times: lightningcss twice and axe-core once. The last one is my favourite finding in the audit:
$ pnpm why axe-core
axe-core@4.12.0
└─┬ eslint-plugin-jsx-a11y@6.10.2
└─┬ eslint-config-next@16.2.7
└── nextjs@0.1.0 (devDependencies)
A complete accessibility rule engine, installed, current, sitting in node_modules, reached by a linter that cannot currently run in this project at all. We have the tool that would audit our own pages and it is wired to nothing.
CC-BY-4.0: caniuse-lite. A data licence on the browser support data behind browserslist. Creative Commons Attribution means attribution, which nobody in the JavaScript ecosystem gives it, including us.
MIT-0: postal-mime. An email parser, arriving inside resend, an email sender. MIT-0 is MIT with the attribution clause removed, which is the one licence in the table that explicitly tells you not to bother.
(MIT AND Zlib), (MIT OR CC0-1.0), (MPL-2.0 OR Apache-2.0), CC0-1.0, 0BSD. pako, a type-fest from 2019 still pinned at 0.7.1 by something, dompurify, the IANA language subtag registry, and tslib. Five rows, five transitive, zero decisions for us to make.
What the visitor actually receives
Here is the part that turned a boring audit into a post. Our 79 public pages reference 32 JavaScript chunks. I grepped all of them:
$ grep -lE '@license|Licensed under|Copyright \(c\)' ch2/*.js | wc -l
0
Zero. Not one licence header in any chunk we serve. The only attribution-shaped string in the entire bundle is a zloirock.ru URL inside a core-js error message, in a chunk marked noModule that no modern browser ever fetches.
That is not because the libraries lack notices. The largest chunk we ship is 431,224 bytes and it is react-dom. Here is the top of the file it is built from:
$ head -12 node_modules/react-dom/cjs/react-dom-client.production.js
/**
* @license React
* react-dom-client.production.js
*
* Copyright (c) Meta Platforms, Inc. and affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
/*
Modernizr 3.0.0pre (Custom Build) | MIT
*/
And here is what survives into the chunk a visitor downloads, which you can check yourself without an account:
$ curl -s https://pub-trivia.app/_next/static/chunks/3m0h3pqana6sj.js \
| grep -c -e '@license' -e 'Copyright' -e 'Meta Platforms' -e 'Modernizr'
0
Two notices in, zero notices out. The MIT licence has exactly one condition, and it is that the copyright notice travels with substantial portions of the software. Every minified JavaScript bundle on the internet is in the same position, nobody has ever been sued over it, and it is still the one requirement of the one licence covering 511 of our 608 rows.
The fonts are a smaller version of the same thing. We serve two woff2 files from next/font, and the repository also carries four Geist TTFs for generating social cards. The notice is inside the binary, in the font's name table:
copyright = Copyright 2024 The Geist Project Authors (https://github.com/vercel/geist-font)
license url = https://openfontlicense.org
license desc = (absent)
So the only attribution this product distributes to anybody is a copyright string in a font table that no browser displays, and the field meant to hold the licence text is empty.
Meanwhile our public site has exactly three legal pages, privacy, terms and cookies, and no attributions page. You can confirm that from the footer of any page on the site in about four seconds.
What we are doing about it
Adding a generated attributions page, from the lockfile rather than from node_modules, listing the packages that actually reach a browser or a container rather than all 606. That is the honest scope: a notice file that claims to cover 608 dependencies when the overwhelming majority of them never leave my laptop is theatre, and the 23 in the container plus the dozen libraries in the client bundles are a list a person can actually read.
Two things I would suggest if you run this on your own repo, which takes about one command. Filter by workspace, because the deployed surface and the development surface have almost nothing to do with each other. And grep your own bundles for @license before you assume the notices are travelling, because the odds are they are not.
Top comments (0)