dxc-technology / halstack-react

Library of components for building SPAs with React and Halstack Design System
https://developer.dxc.com/halstack/
Apache License 2.0
15 stars 14 forks source link

Include styled components as dependency of the CDK #1663

Closed kukoc closed 1 year ago

kukoc commented 1 year ago

Creating a new react project with vite and installing halstack CSK is not enough to start importing halstack components. The app compilation would fail until that syled-components package is installed.

Example:

  1. Create a new React App using $ npm create vite@latest
  2. Install the @dxc-technology\halstack-react + project dependencies
  3. import a Halsack component in the App component
  4. Run $npm run dev
  5. See the error.

I would expect styled component to be a Halstack project dependency. Moreover, Using the latest version of styled components, I experienced weird behaviours with containers. Halstack should be using a fixed version.

GomezIvann commented 1 year ago

This "problem" leads to a larger and much more complex discussion about our dependencies as a library of React components. You can join it here: https://github.com/dxc-technology/halstack-react/discussions/1664.

For the moment and to solve the issue, you can update your local version of npm to the 7th and newer to automatically install peer dependencies of libraries in projects (see their release notes):

npm i -g npm@7.24.2