CRA not working out of the box, here is how I set it up
See original GitHub issueI just want to provide a solution on how to get this working with create-react-app.
In CRA custom env variables have to be prefixed. See https://create-react-app.dev/docs/adding-custom-environment-variables/
I use this npm script to start the app. (not sure if cross-env is actually needed these days)
cross-env REACT_APP_DEBUG=app:* react-scripts start
I thought debug will use console.info
for logging in browsers, but for some reason using debug.enable(process.env.REACT_APP_DEBUG)
does not work.
So I ended up using
import debug from 'debug';
if (process.env.REACT_APP_DEBUG) {
debug.enable(process.env.REACT_APP_DEBUG);
debug.log = console.info.bind(console);
}
The process could be easier for newbies like me if there was a section in the docs explaining hot it works in the browser/CRA.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:5 (2 by maintainers)
Top Results From Across the Web
CRA not working out of the box, here is how I set it up #822
I just want to provide a solution on how to get this working with create-react-app. In CRA custom env variables have to be...
Read more >Your browser and troubleshooting tips - Canada.ca
Here are some tips if you experience issues accessing the CRA sign-in services. Refresh your browser; Try using a different browser; Try using...
Read more >Filling out the T4 slip - Canada.ca
Enter in box 50 the seven‑digit registration number the CRA issues for a registered pension plan (RPP) or a deferred profit sharing plan...
Read more >Registration process to access the CRA sign-in services
Step 1 – Provide personal information. Enter your social insurance number. Enter your date of birth. Enter your current postal code or ZIP ......
Read more >Update your CRA information: Change your address
This page provide information on how to change your address for income tax refunds, Canada Child Tax benefit payments and GST/HST credit ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had trouble too, logs weren’t showing, but the issue was my browser console was not set to show “verbose” logs.
This package doesn’t have anything to do with CRA, though. That’s CRA’s job to document their system. Feel free to open an issue there about them adding docs to their project.