WebpackBuilder: Remove need for react as peerDependency#23496
Merged
WebpackBuilder: Remove need for react as peerDependency#23496
react as peerDependency#23496Conversation
Member
Author
|
@shilman 1 of my learnings from my spike, that I deemed safe enough to extract and possible push for 7.2 I'm open to your ideas & feedback |
14 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What I did
I noticed that
ui/componentsandlib/manager-apihave -rightfully- a peerDependency onreact.Those packages are imported into the webpack builder causing it to also depend on
react(via a peerDependency)That causes the webpack frameworks to all depend on
react(via a peerDependency).The reason why the
ui/componentsandlib/manager-apiare used in the webpack builder is unclear:It's likely a left-over from the olden days when the builder was used for both, and it was just always left in place in some form... never re-evaluated properly.
I left the code in place to add aliases, though I think this code should be removed.
By removing the dependencies the require.resolve used to add the alias will likely start failing in some sitations.
I wrapped it with a try-catch, so if the resolve fails, the alias is not added.
I suspect the alias might only be useful for us internally, not for outside users.
The only need you'd ever have to ensure a single version of the packages (which is what aliases are used for here) would be for addon-docs.
Addon docs should add these aliases if they are needed for some reason IMHO. Addon-docs already has a react dep, so there it would be fine.
How to test
Webpack based sandboxes should continue to work, including docs pages and MDX pages.
Checklist
MIGRATION.MD
Maintainers
ci:normal,ci:mergedorci:dailyGH label to it to run a specific set of sandboxes. The particular set of sandboxes can be found incode/lib/cli/src/sandbox-templates.ts["cleanup", "BREAKING CHANGE", "feature request", "bug", "build", "documentation", "maintenance", "dependencies", "other"]