Skip to content

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

@BillyRayPreachersSon

Description

@BillyRayPreachersSon

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:

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions