ember-cli / ember-cli/ember-cli-inject-live-reload

Starting Ember 5.8.x with a blank `rootURL` throws an error because `baseURL` is `undefined` and so has no `replace` method

Open
#197 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
23
Forks
49
PR merge metrics
No merged PRs in 30d

Description

We're upgrading from Ember 3.28.x to 5.8.x, and have found an issue when starting our Ember server.

We've got no `liveReloadBaseUrl` config and no `baseURL` config, but we do have an empty string for our `rootURL` config.

The problem is that https://github.com/ember-cli/ember-cli-inject-live-reload/blob/master/lib/index.js#L51 checks as follows:
```javascript
let baseURL = options.liveReloadBaseUrl || options.rootURL || options.baseURL;
...
let baseURLWithoutHost = baseURL.replace(/^https?:\/\/[^/]+/, '');
```

This is problematic because with an `undefined` value for both `options.liveReloadBaseUrl` and `options.baseURL`, `baseURL` resolves to `undefined` and so the `.replace` call is failing, even though we have a defined value of `''` for `options.rootURL`.

I've added a temporary workaround (setting `baseURL` to `''` in `.ember-cli`), and that appears to work... however, it would be nice to not have to add this workaround.

Would it be possible to use `??` instead of `||` for the falsey check?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.