fix: treat @openedx/frontend-build as an optional peerDep to avoid direct dep in consuming MFEs #790
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.
Related discussions:
Corresponding PR:
Description:
Demonstrates treating
@openedx/frontend-buildas an optional peer dependency within@edx/frontend-platform, such that consuming MFEs no longer considers@openedx/frontend-buildas a direct dependency, via:{ "peerDependenciesMeta": { "@openedx/frontend-build": { "optional": true } } }From @brian-smith-tcril here:
This indeed does pose a problem for consuming MFEs as
@openedx/frontend-buildshould not be considered as a directdependencieswhen the MFE itself installs@openedx/frontend-buildas adevDependencies.Why might this optional peer dependency might work?
Testing the optional peer dependency approach with frontend-app-communications (PR),
@openedx/frontend-buildis no longer treated a direct dependency, but instead receivesdevOptional: trueinpackage-lock.json(source).While
npm ci --omit=devdoesn't omit@openedx/frontend-buildfrom being installed for the MFE,npm ci --omit=dev --omit=optionalwould.Merge checklist:
frontend-platform. This can be done by runningnpm startand opening http://localhost:8080.module.config.jsfile infrontend-build.fix,feat) and is appropriate for your code change. Consider whether your code is a breaking change, and modify your commit accordingly.Post merge: