diff --git a/config/webpack.config.js b/config/webpack.config.js index 096d8b87..386dbe5b 100644 --- a/config/webpack.config.js +++ b/config/webpack.config.js @@ -586,6 +586,10 @@ module.exports = function (webpackEnv) { ].filter(Boolean), }, plugins: [ + // https://github.com/palantir/blueprint/issues/2193 + new webpack.NormalModuleReplacementPlugin( + /.*\/@blueprintjs\/icons\/lib\/esm\/iconSvgPaths.*/, + path.resolve(__dirname, "../src/blueprintjs-icons.js")), new CopyPlugin({ patterns: [ { diff --git a/src/blueprintjs-icons.js b/src/blueprintjs-icons.js new file mode 100644 index 00000000..9d5a175c --- /dev/null +++ b/src/blueprintjs-icons.js @@ -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 };