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.

Watching `__dirname` and not what I set `path` to

See original GitHub issue

What is the problem

When I set the path to watch as a different path other than __dirname, it doesn’t seem to work … what I mean is that it seems to watch changes only in __dirname, and not the path that I specified

How to reproduce

  • Clone blocks/desktop
  • yarn
  • yarn add -D electron-reload
  • Add this code to main/index.js:
require('electron-reload')(path.join(__dirname, '..', 'src'), {
  electron: path.join(__dirname, '..', 'node_modules', '.bin', 'electron')
})
  • yarn start
  • Change line 83 in src/index.js to:
- <span sx={{ ml: 2 }}>Back</span>
+ <span sx={{ ml: 2 }}>Testing</span>
  • Navigate to some MD or MDX file in your filesystem
  • It will show up as <- Back and not as <- Testing! For example:
Before After

Additional information

OS: macOS 10.14.4 (18E226) … Mojave node: 10.15.2 yarn: 1.15.2 electron: 5.0.7

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:21 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
yan-fotocommented, Jul 23, 2019

Please leave this open. I’ll use it as a cue for implementing the events.

1reaction
yan-fotocommented, Jul 22, 2019

Yes please let me know 🙏 . In the last release we made the assumption that the main file requires electron-reload. Maybe it doesn’t make sense for specific projects and we need to revert back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

path.dirname on Windows path is giving `.` - Stack Overflow
How come it is not giving me C:\\Users\\Blagoh\\Documents\\GitHub\\Screeenshoter\\dist\\electron ? I want that main part chopped off. node.js ...
Read more >
os.path.dirname not doing what you think in file.makedirs_ if ...
I just ran a simple test of what's going on in makedirs_ because I couldn't understand why a directory wasn't being created on...
Read more >
Alternatives to __dirname in Node.js with ES modules
To get __dirname (and __filename ) back, you can add code like this to the top of any file that needs it: import...
Read more >
dirname - Macintosh Terminal Pocket Guide [Book] - O'Reilly
The dirname command, given a file path, prints the name of the directory that contains it: ➜ dirname /Users/smith/finances/money.txt /Users/smith/finances.
Read more >
Path Operations - Essential Java Classes - Oracle Help Center
Examples and practices described in this page don't take advantage of ... A Path instance contains the information used to specify the location...
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