Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support empty rootURL with Ember CLI >= 5.0 #196

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,13 @@ module.exports = {

let self = this;
// maintaining `baseURL` for backwards compatibility. See: http://emberjs.com/blog/2016/04/28/baseURL.html
let baseURL = options.liveReloadBaseUrl || options.rootURL || options.baseURL;
let baseURL = options.liveReloadBaseUrl ?? options.rootURL ?? options.baseURL;

// express requires absolute paths
if (baseURL === '') {
baseURL = '/';
}
Comment on lines +51 to +56
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an alternative pattern we could fall back to '/' not only if baseURL is an empty string but always when it is falsy. This would match previous behavior of Ember CLI more closely as options.baseURL had such a fallback.

Suggested change
let baseURL = options.liveReloadBaseUrl ?? options.rootURL ?? options.baseURL;
// express requires absolute paths
if (baseURL === '') {
baseURL = '/';
}
let baseURL = options.liveReloadBaseUrl || options.rootURL || options.baseURL || '/';

I'm not much opinionated on either or option.


if (this.parent) {
let checker = new VersionChecker(this.parent);
let depedency = checker.for('ember-cli');
Expand Down