Skip to content

Add conditionalNames to webpack in address-search#9248

Merged
gina-yamada merged 2 commits intomainfrom
updateAddressSearchWebpack
Sep 21, 2023
Merged

Add conditionalNames to webpack in address-search#9248
gina-yamada merged 2 commits intomainfrom
updateAddressSearchWebpack

Conversation

@gina-yamada
Copy link
Contributor

@gina-yamada gina-yamada commented Sep 20, 2023

🎫 Ticket

For tickets LG-10330 and LG-10785, new versions of @18f/identity-address-search were 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 inside app/javascript/packages/address-search/webpack.config.cjs.

Before this was added, yarn run webpack would cause errors when ran inside app/javascript/packages/address-search
because 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

  • Step 1 On a branch other than this one, move into app/javascript/packages/address-search and run yarn run webpack. Observer errors. You can also try to publish to npm, you likely won't be successful.
  • Step 2 On this branch, app/javascript/packages/address-search and run yarn run webpack. Observer no errors with the build

@gina-yamada gina-yamada marked this pull request as ready for review September 20, 2023 22:24
Copy link
Contributor

@sheldon-b sheldon-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)

@gina-yamada
Copy link
Contributor Author

gina-yamada commented Sep 20, 2023

@sheldon-b Thanks for your thoughts on version. I was updating my comment as you were writing yours. I arrived at the same conclusion.

@gina-yamada gina-yamada merged commit b02aa6d into main Sep 21, 2023
@gina-yamada gina-yamada deleted the updateAddressSearchWebpack branch September 21, 2023 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants