Closed cprussin closed 8 years ago
Hey, I can't reproduce the issue and I'm wondering if it's Linux-specific (hard to believe, but who knows).
Could you open up the console inside Electron? That's where the filewatcher is running, I'd love to see if there are any issues.
Console looks fine:
$ ember electron
version: 2.4.2
Building...
Build successful - 1644ms.
Slowest Trees | Total
----------------------------------------------+---------------------
StubGenerator | 183ms
StylusCompiler | 174ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (16) | 235ms (14 ms)
StubGenerator (2) | 187ms (93 ms)
StylusCompiler (1) | 174ms
TemplateCompiler (4) | 121ms (30 ms)
--------------------------------------------------------------------
Ember Inspector running on http://localhost:30820
Open the inspector URL in a browser to debug the app!
--------------------------------------------------------------------
Starting Electron...
--------------------------------------------------------------------
file deleted components/live-clock/template.em~
file deleted components/live-clock/4913
file changed components/live-clock/template.em
Build successful - 726ms.
Slowest Trees | Total
----------------------------------------------+---------------------
Babel | 218ms
StylusCompiler | 153ms
TemplateCompiler | 68ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (16) | 239ms (14 ms)
StylusCompiler (1) | 153ms
TemplateCompiler (4) | 77ms (19 ms)
I doubt it's filesystem related, since live-reload works fine on the same app running ember s
instead of ember electron
. When I watch the network tab in the inspector, I see that the livereload connection is not open:
EDIT: By the way, the error you see and the extra websocket connection are parts of the application I'm working on, but I'm seeing the same behavior on a fresh app too, so those are not relevant.
So my guess is that the livereload header is not being injected on to the page properly. I'm not sure what I should be looking for, so I can't confirm for sure that it isn't there--but I see nothing in the DOM or the page resources to indicate that there is any livereload code being delivered to the application.
Did the blueprint run correctly? You shouldn't see livereload as a websocket at all. You should see Ember Inspector.
We're not using livereload here - we're instead having the page watch for changes itself.
To be safe, run ember g ember-electron
again.
I'm switching off my main app to a dummy app for testing. I followed the same steps I pasted in before -- that is:
ember init
ember install ember-electron
ember electron
So, the blueprint should be fine. But no live reload. Running ember g ember-electron
has no impact.
Anything I should look for in the web inspector? I'm not sure why Ember Inspector isn't there... I figured I needed to run the Ember Inspector through my other browser using the URL that comes up in the console after running ember electron
.
On the dummy app:
$ ember g ember-electron
version: 2.4.2
installing ember-electron
identical config/environment.js
identical electron.js
identical tests/electron.js
identical tests/package.json
Ember Electron requires configuration. Please consult the Readme to ensure that this addon works!
https://github.com/felixrieseberg/ember-electron
install package ember-inspector
Installed packages for tooling via npm.
$ ember electron
version: 2.4.2
Building...
Build successful - 787ms.
Slowest Trees | Total
----------------------------------------------+---------------------
SourceMapConcat: Concat: Vendor /assets/ve... | 131ms
Babel | 57ms
Babel | 52ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (12) | 193ms (16 ms)
SourceMapConcat: Concat: Vendor /asset... (1) | 131ms
TemplateCompiler (2) | 39ms (19 ms)
--------------------------------------------------------------------
Ember Inspector running on http://localhost:30820
Open the inspector URL in a browser to debug the app!
--------------------------------------------------------------------
Starting Electron...
--------------------------------------------------------------------
(electron) companyName is now a required option to crashReporter.start
file deleted templates/application.hbs~
file changed templates/application.hbs
Build successful - 146ms.
Slowest Trees | Total
----------------------------------------------+---------------------
TreeMerger (addon-test-support) | 8ms
Slowest Trees (cumulative) | Total (avg)
----------------------------------------------+---------------------
Babel (12) | 18ms (1 ms)
TreeMerger (addon-test-support) (1) | 8ms
I tried putting breakpoints all over the reload
module, and none are being hit. I tried on the line if (!window.ELECTRON)
, as well as in the callback for stat
and for watch
--none of them are triggered.
EDIT: This may be a red herring. It appears no breakpoints are being triggered in Electron's webinspector at all.
Yeah, maybe just set a console.log. We've had some issues with breakpoints in the lastest Electron release.
OK, I see the watch being set up, but the callback is not being triggered when the files are changing. Will update as I continue investigating.
Thanks a lot!
AH! Progress.
So, if I manually update dist/index.html
, then I get a reload. If I manually update dist/assets/atest.js
, no reload.
So I checked the docs for fs.watch
:
Caveats#
The fs.watch API is not 100% consistent across platforms, and is unavailable in some situations.
The recursive option is only supported on OS X and Windows.
:(
But, the dist
folder for the most part will only have two levels--the root and the tests
and assets
folders. Would you accept a PR that sets up watches on the subfolders manually?
If you put a little if (process.platform === 'linux')
around it, I'd even be super thankful!
Done :) thanks for helping point out the appropriate places to look in the code
@cprussin, is this still working for you in 1.4.3? I'm on Linux Mint 17.3 and experiencing these symptoms again, and was hoping for a double check to make sure it's not just me before creating an issue.
@superlou no problems here with 1.4.3. Try playing with the code in app/electron/reload.js -- make sure you aren't getting errors from fs.watch
, and ensure the paths passed to it are correct.
@superlou: Could you do me a favor? Update ember-electron
and run ember generate ember-electron
again - I may have fixed a small bug that lead to brand new projects having a live-reload issue.
@felixrieseberg: just updated to 1.4.5. Still have the same issue (reloads if changes in /dist but not in electron.js). However, I just noticed that my ember inspector is also not working (ember application not detected at http://localhost:30820/), so maybe I have some other issues masquerading as this one.
My versions:
Steps to reproduce:
ember init
ember install ember-electron
ember electron