-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webpack: add hack to remove unused icons
This follows the suggestions from [1] to reduce the package size by only including the icons we are actually using. This gets the main module small enough to avoid the CRA "The bundle size is significantly larger than recommended." warning (gzipped size is < 512KB). [1]: palantir/blueprint#2193
- Loading branch information
Showing
2 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
// SPDX-License-Identifier: MIT | ||
// Copyright (c) 2022 The Pybricks Authors | ||
|
||
// HACK: Prevent webpack from picking up all icons. | ||
// https://github.com/palantir/blueprint/issues/2193 | ||
|
||
import { | ||
Add, | ||
Archive, | ||
Blank, | ||
Chat, | ||
ChevronDown, | ||
ChevronRight, | ||
Clipboard, | ||
Code, | ||
Cog, | ||
Cross, | ||
Disable, | ||
Document, | ||
Download, | ||
Duplicate, | ||
Edit, | ||
Error, | ||
Export, | ||
Help, | ||
Import, | ||
InfoSign, | ||
Lightbulb, | ||
Play, | ||
Plus, | ||
Redo, | ||
Refresh, | ||
Share, | ||
Tick, | ||
TickCircle, | ||
Trash, | ||
Undo, | ||
Virus, | ||
} from '@blueprintjs/icons/lib/esm/generated/16px/paths'; | ||
import { | ||
Cog as Cog20, | ||
Document as Document20, | ||
} from '@blueprintjs/icons/lib/esm/generated/20px/paths'; | ||
import { pascalCase } from 'change-case'; | ||
|
||
export function iconNameToPathsRecordKey(name) { | ||
return pascalCase(name); | ||
} | ||
|
||
export const IconSvgPaths16 = { | ||
Add, | ||
Archive, | ||
Blank, | ||
Chat, | ||
ChevronDown, | ||
ChevronRight, | ||
Clipboard, | ||
Code, | ||
Cog, | ||
Cross, | ||
Disable, | ||
Document, | ||
Download, | ||
Duplicate, | ||
Edit, | ||
Error, | ||
Export, | ||
Help, | ||
Import, | ||
InfoSign, | ||
Lightbulb, | ||
Play, | ||
Plus, | ||
Redo, | ||
Refresh, | ||
Share, | ||
Tick, | ||
TickCircle, | ||
Trash, | ||
Undo, | ||
Virus, | ||
}; | ||
|
||
export const IconSvgPaths20 = { Cog: Cog20, Document: Document20 }; |