mirror of
https://github.com/lucide-icons/lucide.git
synced 2026-12-02 16:49:06 +00:00
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:
co-authored by
grzdev
Eric
parent
9e7b1ce5a9
commit
752213bb38
@@ -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'],
|
||||
|
||||
Reference in New Issue
Block a user