-
Notifications
You must be signed in to change notification settings - Fork 67
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
Support selective version resolutions in esm-views #1872
Support selective version resolutions in esm-views #1872
Conversation
🦋 Changeset detectedLatest commit: 8035848 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
docs/esm-views/known-limitations.md
Outdated
particularly relevant in case the `peerDependency` in question is stateful: | ||
suppose, for example, that one of your ESM Views depends on `react@17.0.1`, but | ||
one of your dependencies on the CDN depend on `react@>16.8.0` (pretty common if | ||
the dependency use hooks). Depending on the moment that yor dependency was first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo: your
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the dependency use hooks). Depending on the moment that yor dependency was first | |
the dependency use hooks). Depending on the moment that your dependency was first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
docs/esm-views/known-limitations.md
Outdated
CDN). [It also provides `[selectiveCDNResolutions]`](./esm-cdn.md), a template | ||
string to automatically translate | ||
[Yarn selective version resolutions](https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/) | ||
to lists of locked dependencies. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it possible to have an example for each solution for the same React 16.8/17 example you referred to above? But this time showing the Modular solutions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with a few typos
// Some CDNs support this mechanism - https://github.com/esm-dev/esm.sh#specify-external-dependencies | ||
// This is especially useful if we have stateful dependencies (like React) that we need to query the same version through all our CDN depenencies | ||
// We just output them as a comma-separated parameter in the CDN template as [selectiveCDNResolutions] | ||
// TODO: possibly fallback to a filtered version of resolutions if this is not present |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this TODO in the code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM except for some small typos. I also added a suggestion to add an example
Co-authored-by: Steve King <steve@mydev.co> Co-authored-by: Sam Brown <sam@sgb.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
resolutions
are formatted as a CSV in the[selectiveCDNResolutions]
template field. Since external dependencies in esm.sh are a similar concept to selective dependencies resolutions in Yarn (they both lock a subdependency version through the whole dependency tree), it makes sense to have this courtesy template token.peerDependency
es resolution at CDN build time work and how the problem of multiple stateful dependencies is solved by the currently available CDNs.