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

feat: Preact versioning #393

Merged
merged 6 commits into from
Apr 2, 2024
Merged

feat: Preact versioning #393

merged 6 commits into from
Apr 2, 2024

Conversation

andy-haynes
Copy link
Contributor

@andy-haynes andy-haynes commented Mar 28, 2024

This PR updates the way Preact dependencies are imported and specified for third-party packages. In particular:

  • Preact version is no longer configurable outside the compiler
  • Preact dependencies are specified as stable/ builds to ensure the same instance is used within the imported package
  • Preact dependencies are marked as external to ensure only one instance of Preact is used
  • preact/compat import paths have been updated to include the build hash (X-YS9yZWFjdDpwcmVhY3QvY29tcGF0) that appears to always be imported by esm.sh bundles when react is swapped out for preact/compat subpaths required when marking preact as an external dependency

This fixes #323 and unblocks progress on importing other libraries (tested with @chakra-ui so far), though the latter still needs some work.

Copy link

vercel bot commented Mar 28, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
bos-web-engine ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 2, 2024 0:03am
bos-web-engine-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 2, 2024 0:03am
bos-web-engine-sandbox ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 2, 2024 0:03am

@andy-haynes
Copy link
Contributor Author

While this does fix the issue in #323, it requires specifying version 10.20.1 which does not play nice with @chakra-ui. There are still some things to uncover, but I'm starting to think we won't have a nice way to import arbitrary dependencies without being able to exercise more control over how dependencies are built.

@mpeterdev
Copy link
Collaborator

Phosphor icons do not appear to work on this branch even with the full path specifier. Is that expected?

@andy-haynes
Copy link
Contributor Author

Phosphor icons do not appear to work on this branch even with the full path specifier. Is that expected?

It's broken in production since @phosphor-icons/[email protected] was published. 2.1.4 is not compatible with any Preact version I've tried, 2.0.15 is the last working I know of.

However there's a bug with specifying a version with subpaths, i.e. it should be specified as @phosphor-icons/[email protected]/dist/icons/Horse but that ends up pulling everything down 😑

I'll create an issue for the subpath versioning and fix the Component in that PR.

@andy-haynes andy-haynes merged commit a4307ab into main Apr 2, 2024
6 checks passed
@andy-haynes andy-haynes deleted the feat/preact-versioning branch April 2, 2024 18:25
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.

Handle conflicting Preact versions when importing packages
2 participants