Add conditionalNames to webpack in address-search#9248
Merged
gina-yamada merged 2 commits intomainfrom Sep 21, 2023
Merged
Conversation
gina-yamada
commented
Sep 20, 2023
… to be able to publish to npm
sheldon-b
approved these changes
Sep 20, 2023
Contributor
sheldon-b
left a comment
There was a problem hiding this comment.
LGTM. This matches the config used in @18f/identity-components and testing it locally I was able to build the package successfully (which I wasn't able to do before this change)
Contributor
Author
|
@sheldon-b Thanks for your thoughts on version. I was updating my comment as you were writing yours. I arrived at the same conclusion. |
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.
🎫 Ticket
For tickets LG-10330 and LG-10785, new versions of
@18f/identity-address-searchwere trying to be published on npm but build errors occurred. The solution is to update the webpack.config file for address-search so that dependencies can be resolved.🛠 Summary of changes
Added
conditionNames: ['source']to the resolve object insideapp/javascript/packages/address-search/webpack.config.cjs.Before this was added,
yarn run webpackwould cause errors when ran insideapp/javascript/packages/address-searchbecause webpack didn’t know how to resolve a dependency when that dependency is itself. The conditionNames tells webpack to resolve its dependencies (one of which is itself!) using the source export. (Explanation & code change taken from Matt in this thread. I am implementing this to get unblocked.)
📜 Testing Plan
app/javascript/packages/address-searchand runyarn run webpack. Observer errors. You can also try to publish to npm, you likely won't be successful.app/javascript/packages/address-searchand runyarn run webpack. Observer no errors with the build