Watching `__dirname` and not what I set `path` to
See original GitHub issueWhat 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
yarnyarn 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.jsto:
- <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
<- Backand 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:
- Created 4 years ago
- Comments:21 (11 by maintainers)
Top 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 >
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 Free
Top 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



Please leave this open. I’ll use it as a cue for implementing the events.
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.