fix(lucide-react): include license banner once instead of in every module (#5209)

* fix(lucide-react): include license banner once instead of in every module

* Adjust config

---------

Co-authored-by: grzdev <grzdev@users.noreply.github.com>
Co-authored-by: Eric <eric.fennis@gmail.com>
This commit is contained in:
Dami Oyeniyi
2026-11-24 17:02:24 +01:00
committed by GitHub
co-authored by grzdev Eric
parent 9e7b1ce5a9
commit 752213bb38
+10 -1
View File
@@ -59,6 +59,11 @@ const bundles = [
},
];
// Only add the license banner to Icon.mjs in ESM builds, so it appears once in a bundle (#3744).
// Every icon imports Icon. The CJS build is one file and keeps its banner.
const licenseModuleMatcher = /[/\\]src[/\\]Icon\.ts$/;
const isNotLicenseChunk = (chunk) => !licenseModuleMatcher.test(chunk.facadeModuleId ?? '');
const configs = bundles
.map(
({
@@ -76,7 +81,11 @@ const configs = bundles
inputs.map((input) => ({
input,
plugins: [
...plugins({ pkg, minify }),
...plugins({
pkg,
minify,
licenseBannerExclude: format === 'esm' ? isNotLicenseChunk : undefined,
}),
// Make sure we emit "use client" directive to make it compatible with Next.js
preserveDirectives({
include: ['src/lucide-react.ts', 'src/DynamicIcon.ts', 'src/context.ts', 'src/Icon.ts'],