electron-userland / electron-compile

DEPRECATED: Electron supporting package to compile JS and CSS in Electron applications
1.01k stars 99 forks source link

Angular app-routing causes electron-compile to fail : "Can't stat" #233

Open nphias opened 7 years ago

nphias commented 7 years ago

https://github.com/electron-userland/electron-forge-templates/issues/33

PhoneixS commented 5 years ago

I think I have the same problem but because I'm trying to use autorefresh. Also, I think that the problem could be that the autorefresh is receiving that the directory had changed and it tries to compile the directory instead of the files.

After enabling auto-reload with

const { enableLiveReload } = require('electron-compile');

enableLiveReload();

I compile-watch the project with ng build --outputPath=dist/ghexamenes --watch=true and in another terminal electron-forge start ..

This is the debug log when a change in code is produced:

electron-compile:protocol-hook Intercepting url file:///home/jabellota/Proyectos/Proyectos%20Angular/ghexamenes/dist/ghexamenes/ +22s
  electron-compile:compiler-host Compiling /home/jabellota/Proyectos/Proyectos Angular/ghexamenes/dist/ghexamenes/ +0ms
  electron-compile:sanitize-paths Cache miss for cachedRealpath: '/home/jabellota/Proyectos/Proyectos Angular/ghexamenes/dist/ghexamenes/' => '/home/jabellota/Proyectos/Proyectos Angular/ghexamenes/dist/ghexamenes' +1ms
  electron-compile:protocol-hook Failed to compile /home/jabellota/Proyectos/Proyectos Angular/ghexamenes/dist/ghexamenes/: Can't stat /home/jabellota/Proyectos/Proyectos Angular/ghexamenes/dist/ghexamenes/
  electron-compile:protocol-hook Error: Can't stat /home/jabellota/Proyectos/Proyectos Angular/ghexamenes/dist/ghexamenes/
  electron-compile:protocol-hook     at /home/jabellota/Proyectos/Proyectos Angular/ghexamenes/node_modules/electron-compile/lib/file-change-cache.js:183:42
  electron-compile:protocol-hook     at Generator.next (<anonymous>)
  electron-compile:protocol-hook     at step (/home/jabellota/Proyectos/Proyectos Angular/ghexamenes/node_modules/electron-compile/lib/file-change-cache.js:27:191)
  electron-compile:protocol-hook     at /home/jabellota/Proyectos/Proyectos Angular/ghexamenes/node_modules/electron-compile/lib/file-change-cache.js:27:361
  electron-compile:protocol-hook     at process._tickCallback (internal/process/next_tick.js:68:7) +0ms

Moreover, if I change initializeProtocolHook to manually check if it is the root and then change the filePath to the index.html instead, it does the refresh correctly. So I also vote for when using angular root route it tries incorrectly to compile the directory instead of the index.html file.