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

fix(babel): use caret to specify some package versions #9174

Merged
merged 1 commit into from
Sep 15, 2023

Conversation

jtoar
Copy link
Contributor

@jtoar jtoar commented Sep 15, 2023

the previous babel fix (#9144) to issues like #9156 and #9073 was only a temporary solution and didn't work for all users. after more thinking, i'm pretty sure that the root of the problem is that we pin the version of the babel packages we depend on.

take a redwood app that was just created from yarn create redwood-app. most redwood projects request a specific version of a babel package. for example, for @babel/core, redwood packages say they want 7.22.17. the redwood packages aren't the only ones that want @babel/core, but they use a caret when they ask for the version, like ^7.22.5

at the outset, yarn can usually make everyone happy with one version. but say a new version of @babel/core comes out, 7.22.19. and then a user installs storybook, or some other package that depends on @babel/core. the problem is that yarn checks npm to see if there's a new version, and if there is, it updates the caret versions like ^7.22.5 to resolve to the new one. but all the redwood packages are insisting they want 7.22.17, not 7.22.19, so yarn has to keep both around and now, when it comes to hoisting, has a choice to make: which version of @babel/core is at node_modules/@babel/core? more packages are ok with 7.22.19 so it wins out, and 7.22.17 gets buried into the redwood package's node_modules.

to figure out which babel packages need the caret, i relied on a combination of yarn info -R --dependents ${packageName}, yarn why ${packageName}, and find ./node_modules -type d -path '*/${packageName}'.

the next steps for this are to get it into canary so i can confirm.

@jtoar jtoar added the release:fix This PR is a fix label Sep 15, 2023
@jtoar jtoar added this to the next-release-patch milestone Sep 15, 2023
@jtoar jtoar changed the title fix(babel): use caret to specify versions fix(babel): use caret to specify some package versions Sep 15, 2023
@jtoar jtoar force-pushed the ds-babel/use-caret branch from 6b427ee to 7d1261e Compare September 15, 2023 01:33
@jtoar jtoar marked this pull request as ready for review September 15, 2023 01:33
@jtoar jtoar added the fixture-ok Override the test project fixture check label Sep 15, 2023
@jtoar jtoar enabled auto-merge (squash) September 15, 2023 02:13
@jtoar jtoar merged commit dc86db5 into main Sep 15, 2023
29 of 30 checks passed
@jtoar jtoar deleted the ds-babel/use-caret branch September 15, 2023 02:15
jtoar added a commit that referenced this pull request Sep 15, 2023
the previous babel fix (#9144)
to issues like #9156 and
#9073 was only a temporary
solution and didn't work for all users. after more thinking, i'm pretty
sure that the root of the problem is that we pin the version of the
babel packages we depend on.

take a redwood app that was just created from `yarn create redwood-app`.
most redwood projects request a specific version of a babel package. for
example, for `@babel/core`, redwood packages say they want `7.22.17`.
the redwood packages aren't the only ones that want `@babel/core`, but
they use a caret when they ask for the version, like `^7.22.5`

at the outset, yarn can usually make everyone happy with one version.
but say a new version of `@babel/core` comes out, `7.22.19`. and then a
user installs storybook, or some other package that depends on
`@babel/core`. the problem is that yarn checks npm to see if there's a
new version, and if there is, it updates the caret versions like
`^7.22.5` to resolve to the new one. but all the redwood packages are
insisting they want `7.22.17`, not `7.22.19`, so yarn has to keep both
around and now, when it comes to hoisting, has a choice to make: which
version of `@babel/core` is at `node_modules/@babel/core`? more packages
are ok with `7.22.19` so it wins out, and `7.22.17` gets buried into the
redwood package's node_modules.

to figure out which babel packages need the caret, i relied on a
combination of `yarn info -R --dependents ${packageName}`, `yarn why
${packageName}`, and `find ./node_modules -type d -path
'*/${packageName}'`.

the next steps for this are to get it into canary so i can confirm.
@jtoar jtoar modified the milestones: next-release-patch, v6.2.2 Sep 15, 2023
jtoar added a commit that referenced this pull request Sep 15, 2023
the previous babel fix (#9144)
to issues like #9156 and
#9073 was only a temporary
solution and didn't work for all users. after more thinking, i'm pretty
sure that the root of the problem is that we pin the version of the
babel packages we depend on.

take a redwood app that was just created from `yarn create redwood-app`.
most redwood projects request a specific version of a babel package. for
example, for `@babel/core`, redwood packages say they want `7.22.17`.
the redwood packages aren't the only ones that want `@babel/core`, but
they use a caret when they ask for the version, like `^7.22.5`

at the outset, yarn can usually make everyone happy with one version.
but say a new version of `@babel/core` comes out, `7.22.19`. and then a
user installs storybook, or some other package that depends on
`@babel/core`. the problem is that yarn checks npm to see if there's a
new version, and if there is, it updates the caret versions like
`^7.22.5` to resolve to the new one. but all the redwood packages are
insisting they want `7.22.17`, not `7.22.19`, so yarn has to keep both
around and now, when it comes to hoisting, has a choice to make: which
version of `@babel/core` is at `node_modules/@babel/core`? more packages
are ok with `7.22.19` so it wins out, and `7.22.17` gets buried into the
redwood package's node_modules.

to figure out which babel packages need the caret, i relied on a
combination of `yarn info -R --dependents ${packageName}`, `yarn why
${packageName}`, and `find ./node_modules -type d -path
'*/${packageName}'`.

the next steps for this are to get it into canary so i can confirm.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
fixture-ok Override the test project fixture check release:fix This PR is a fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant