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

add direct dependency on illustrations #1744

Merged
merged 4 commits into from
Dec 19, 2023
Merged

Conversation

mayank99
Copy link
Contributor

@mayank99 mayank99 commented Dec 18, 2023

Changes

fixes #1742 (comment) which happens because ErrorPage is part of the barrel file (index.js), resulting in bundlers trying to resolve everything even if it's not used (it later gets tree-shaked)

first i tried catching these errors (a6c4039), but vite and nextjs don't respect this catch. so i've resorted to moving it from a peer dependency to direct dependency.

this effectively undoes the breaking change, so users have one less thing to worry about. and if ErrorPage is not used, this should not be part of the final bundle, so no real downside there.

Testing

no more errors! i've done preliminary testing locally, but I plan to test in sandboxes some more, together with #1734 after this PR is merged.

Docs

added changeset. will also update migration guide after this merges.

@mayank99 mayank99 self-assigned this Dec 18, 2023
@mayank99 mayank99 changed the title fail gracefully if illustrations not found add direct dependency on illustrations Dec 18, 2023
@mayank99 mayank99 marked this pull request as ready for review December 18, 2023 21:55
@mayank99 mayank99 requested review from a team as code owners December 18, 2023 21:55
@mayank99 mayank99 requested review from r100-stack and removed request for a team December 18, 2023 21:55
Copy link
Member

@r100-stack r100-stack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm, would something like new Function('specifier', 'return import(specifier)') and/or /* webpackIgnore: true */ like we had before (code) not fix this issue?

Copy link
Contributor Author

@mayank99 mayank99 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, that's what we had before #1742 and it doesn't work because the illustrations don't get bundled. see https://stackblitz.com/edit/nextjs-ukqiky?file=package.json,app%2Fpage.tsx

webpackignore and/or new Function hacks are only to be used for importing from URLs (which the browser knows how to handle); that's what i was trying to explain in this comment.

@mayank99 mayank99 merged commit 7de79cd into main Dec 19, 2023
16 checks passed
@mayank99 mayank99 deleted the mayank/illustrations-dependency branch December 19, 2023 15:26
@imodeljs-admin imodeljs-admin mentioned this pull request Dec 19, 2023
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.

2 participants