DEV: Simplify livereload configuration for better proxy compatibility (#29742)

When running a development environment behind a proxy (e.g. when using a cloud development environment, or a service like ngrok), the ember-cli port & protocol may not match the one in the browser. `livereload.js` knows how to auto-configure itself based on the current browser environment... but Ember CLI overrides that autoconfiguration with some hard-coded values.

The intention there is to allow running the livereload server on a different port to the ember-cli web proxy. We don't need that functionality.

This commit stops loading `ember-cli-live-reload.js`, and instead loads `_lr/livereload.js` directly.
This commit is contained in:
David Taylor 2024-11-13 16:39:23 +00:00 committed by GitHub
parent 6779b46f55
commit 8d53f8ef1a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -95,8 +95,10 @@ function updateScriptReferences({
);
}
// We use _lr/livereload.js directly instead of ember-cli-live-reload so that the protocol/port is configured automatically
// (important for cloud development environments like GitHub CodeSpaces)
newElements.unshift(
`<script async src="${baseURL}ember-cli-live-reload.js" nonce="${nonce}"></script>`
`<script async src="/_lr/livereload.js?path=_lr/livereload" nonce="${nonce}"></script>`
);
}