-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
[v4] load icons asynchronously #4513
Conversation
e05f92b
to
e2a504c
Compare
Merge branch 'v4' into ad/icons-loadingPreviews: documentation | landing | table |
fix icon test suitePreviews: documentation | landing | table |
fix iso test compilationPreviews: documentation | landing | table |
fix tests, distPreviews: documentation | landing | table |
I'm seeing every icon imported into my nextjs app on 4.0.0. Is there a specific API I should be using to treeshake them dynamically? https://nextjs.org/docs/advanced-features/dynamic-import Before I was overriding the generated/svgPaths file. I generally specify my icons via: |
@switz can you open a new issue and we can try to debug from there? you shouldn't need to configure anything if you're using webpack (which Next.js does use under the hood); this bit of code should be doing the dynamic import for you: blueprint/packages/icons/src/iconLoader.ts Lines 36 to 49 in 184cab8
|
@adidahiya Is this change reversed? |
@proteriax yes, see my comment #4645 (comment) |
Fixes #2193
Checklist
Changes proposed in this pull request:
"es2020"
module target. This is nearly identical to the previous"es2015"
target, but now has support for dynamicimport()
expressions (MDN docs).@babel/plugin-syntax-dynamic-import
, this should require no action on your part. In other words, most modern tooling in the JS ecosystem does support this new feature.{ Icons } from "@blueprintjs/icons"
to load specific icons from the icon setimport { Download } from "@blueprintjs/icons"
<Icon>
component's static SVG path string loader has been replaced by a loader that uses a dynamicimport()
expressionReviewers should focus on:
Screenshot