Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v5] [icons] feat: reduce bundle size, load paths instead of components #6212

Merged
merged 4 commits into from
Jun 9, 2023

Conversation

adidahiya
Copy link
Contributor

@adidahiya adidahiya commented Jun 9, 2023

Fixes #2193 (comment), fixes #6159

Checklist

  • Includes tests
  • Update documentation

Changes proposed in this pull request:

  • ⚠️ BREAK: refactor IconLoader to load icon path modules instead of generated React components
    • This changes the type and semantics of the icon loader function, which now has the signature Icons.load(name: IconName, size: IconSize)
    • If you were previously specifying a custom icon loading function, it will have to be adjusted to account for the new paths of the expected modules:
    loader: async (name, size) => {
      await import(
        /* webpackInclude: /\.js$/ */
        /* webpackMode: "eager" */
    -     `@blueprintjs/icons/lib/esm/generated/components/${name}`
    +     `@blueprintjs/icons/lib/esm/generated/${size}px/paths/${name}`
      ),
    }
  • feat: reduce size of generated icon component modules by deduplicating code with a new shared component <SVGIconContainer>
  • feat: new getIconPaths() function in @blueprintjs/icons which provides a less verbose API to statically load icon paths

Reviewers should focus on:

No regressions

Screenshot

@adidahiya
Copy link
Contributor Author

[v5] [icons] feat: reduce bundle size, load paths instead of components

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

@adidahiya
Copy link
Contributor Author

fix test

Build artifact links for this commit: documentation | landing | table | demo

This is an automated comment from the deploy-preview CircleCI job.

packages/icons/src/index.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant