Skip to content

Config hook called too soon during serve - #7861

Merged
stefanpenner merged 4 commits into
ember-cli:masterfrom
thoov:config-called-to-soon
Jun 5, 2018
Merged

stefanpenner merged 4 commits into
ember-cli:masterfrom
thoov:config-called-to-soon

Conversation

@thoov

@thoov thoov commented May 31, 2018 •

Copy link
Copy Markdown
Contributor

The config hook gets called eagerly during the serve flow and that
leads to issues with the context of the config hooks not being set
up properly. An example of this is if you have:

config() {
  return this.app && this.app.options[this.name];
}

this.app will be undefined but that same hook during a build will not be undefined.

The config hook gets called eagerly during the serve flow and that
leads to issues with the context of the config hooks not being set
up properly. An example of this is if you have:

config() {
  return this.app && this.app.options[this.name];
}

`this.app` will be undefined but that same hook during a build will
not be undefined.
@thoov

thoov commented May 31, 2018

Copy link
Copy Markdown
Contributor Author

@stefanpenner @xg-wang Lets discuss this tomorrow

Comment thread lib/commands/serve.js Outdated

this.ui.writeDeprecateLine(
'Using the `baseURL` setting is deprecated, use `rootURL` instead.',
!(!('rootURL' in config) && config.baseURL));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should also be moved.

Comment thread lib/models/watcher.js Outdated
if (this.serving) {
let options = this.options;
let baseURL = options.rootURL === '' ? '/' : cleanBaseURL(options.rootURL || options.baseURL);
let config = this.options.project.config();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should be something like let config = this.project.config(options.environment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants