question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

CRA not working out of the box, here is how I set it up

See original GitHub issue

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 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:closed
  • Created 2 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
flybayercommented, Jun 25, 2021

I had trouble too, logs weren’t showing, but the issue was my browser console was not set to show “verbose” logs.

1reaction
Qix-commented, Apr 18, 2021

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found