ember-cli-inject-live-reload is an essential plugin for Ember CLI applications, responsible for injecting the necessary live-reload script into the HTML output during development. This script facilitates automatic browser refreshes upon changes to JavaScript or styling, significantly enhancing developer productivity. The current stable version is 2.1.0, though the package has seen infrequent updates, largely due to its stable and foundational role within the Ember CLI ecosystem. Its core function is to dynamically generate and serve `ember-cli-live-reload.js`, which then configures and loads `livereload.js` (provided by Ember CLI's `tiny-lr` dependency) to establish a WebSocket connection for change detection. This transparent integration is a key differentiator, as most vanilla Ember CLI apps require no explicit configuration. Users typically interact with it via `ember serve` options or `.ember-cli` configuration for advanced scenarios like reverse proxies.
npm install ember-cli-inject-live-reloadVerified import paths — ran on the pinned version, not inferred.
Demonstrates how `ember-cli-inject-live-reload` is implicitly used and configured within an Ember CLI project, showing default `ember serve` behavior, disabling via CLI, and advanced configuration in `.ember-cli`.
Configure `liveReloadOptions` and potentially `liveReloadJsUrl` in your `.ember-cli` file to specify the correct host, port, and HTTPS settings that the client will use to connect to the proxy. Ensure your proxy correctly forwards WebSocket traffic.
Check for conflicting processes. You can specify a different `liveReloadPort` either via the `.ember-cli` file or with the `--live-reload-port` command-line flag during `ember serve`.
Adjust your `contentSecurityPolicy` settings in `config/environment.js` to allow WebSocket connections (e.g., `connect-src 'self' ws://localhost:49153`) and ensure the script source is permitted. For HTTPS, use `wss://`.
Ensure `ember serve` is running. Check your browser's console for more specific WebSocket errors. Try specifying a different `liveReloadPort` (e.g., `ember serve --live-reload-port=35730`). If behind a proxy, configure `liveReloadOptions` in `.ember-cli`.
Modify `config/environment.js` to extend your `contentSecurityPolicy` settings. Add `ws://localhost:49153` (or the specific LiveReload host/port) to the `connect-src` directive. For HTTPS environments, use `wss://`.
Verify that `ember serve` is running without the `--no-live-reload` flag. Check the `index.html` source in your browser's developer tools to confirm that the `ember-cli-live-reload.js` script tag is present. If it's not, ensure `ember-cli-inject-live-reload` is installed and `liveReload` is not explicitly set to `false` in `.ember-cli`.