blaise-io / live-reload

Browser extension for web devs. Monitors source files on a page and reloads page or source file when a change is detected.
MIT License
60 stars 9 forks source link

ES Modules imported #12

Closed Blindmikey closed 4 years ago

Blindmikey commented 4 years ago

/src/components/*.js /src/app.js

app.js imports ES modules exported by js files under /src/components However with the rules above, only app.js is being detected. /src/components js files are being loaded as per network inspector

If I add script tags for those component js files, live-reload does pick up on them and detect changes. So changes are only detected if the script is referenced in the html markup. Not sure if this limitation is inherent to this implementation.

blaise-io commented 4 years ago

At the moment the JavaScript files have to be included by the HTML file in order to be eligible for monitoring. This may be too limited, as demonstrated by your issue.

This web extension has the same issue with @imported stylesheets and content loaded by frames.

I should be able to fix that by implementing WebRequest in https://github.com/blaise-io/live-reload/blob/7e435ce084f0a83f5778d10a164104797c68cd59/app/background.ts#L115.

blaise-io commented 4 years ago

This should now work in 1.8.0 if you're on Firefox. ~1.8.0 for Chrome is pending review in the Chrome app store.~ is accepted now.