react-stripe-elements must be installed when it isn't needed #400
Labels
bug
For issues that describe a defect or regression in the released software
good first issue
For issues that a new contributor could likely submit a pull request for without needing much help
Type: minor
Describe the bug
The
react-stripe-elements
dependency is currently needed even when not using any Stripe components.To Reproduce
npx create-react-app my-app
cd my-app
yarn add prop-types styled-components@3 reacto-form @reactioncommerce/components-context @reactioncommerce/components
yarn add --dev react-app-rewired
Then, in
package.json
, update thestart
,build
, andtest
scripts to replacereact-scripts
withreact-app-rewired
:Finally, paste this into a file in the project root directory named
config-overrides.js
:Then add the following at the top of
App.js
:Run
yarn start
and observe the error about the missing dependency.Expected behavior
You should only need to install
react-stripe-elements
when using the Stripe components that require it.Suggested fix
Look at our imports and try to be more specific about where that dependency gets pulled in. For example, if it's imported in
utils
and lots of other things import/utils
rather than a specific util, that is likely the issue.The text was updated successfully, but these errors were encountered: