document happy path(s) for adding Paragon to new create-react-app
projects
#2482
Labels
documentation
Relates to documentation improvements
create-react-app
projects
#2482
@cintnguyen brought this to my attention after hitting a few snags when learning how to consume Paragon components. It seems if someone trying to add Paragon to a new
create-react-app
project follows the instructions in the getting started part of the readme, they will likely encounter some errors.It would be great to add some clarification around dependencies to the docs/readme so new consumers of Paragon can get up and running without issues.
repo steps
npx create-react-app my-app
package-lock.json
andnode_modules
^18.2.0
inpackage.json
with^16.14.0
(version in frontend-template-application)@testing-library/react
version^13.4.0
with^12.1.5
index.js
replaceimport ReactDOM from 'react-dom/client';
withimport ReactDOM from 'react-dom';
index.js
replacewith
🎉 everything runs with
npm start
npm i --save @edx/paragon
App.js
, for example: a buttonimport { Button } from '@edx/paragon';
<Button variant="primary" className="mb-2 mb-sm-0">Primary</Button>
❌ get
Cannot find module 'sass'
errornode-sass
vianpm install --save-dev sass
index.css
toindex.scss
@import '~@edx/paragon/scss/core/core.scss';
to the top ofindex.scss
import './index.css';
inindex.js
withimport './index.scss';
❌ get
Cannot find module '@edx/browserslist-config'
error@edx/browserslist-config
vianpm install --save-dev @edx/browserslist-config
🎉 it works
The text was updated successfully, but these errors were encountered: