-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat(core): integrated bootstrap #483
feat(core): integrated bootstrap #483
Conversation
docs/ENVIRONMENTS.md
Outdated
return modRef; | ||
decorateModule(moduleRef: NgModuleRef<any>): NgModuleRef<any> { | ||
// perform any module customization needed for this specific environment here | ||
// and make sure to invoke this function by passing it the NgModule created by Angular |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the formatting is not correct...
docs/ENVIRONMENTS.md
Outdated
/* do something here */ | ||
decorateModule(moduleRef: NgModuleRef<any>): NgModuleRef<any> { | ||
// perform any module customization needed for this specific environment here | ||
// and make sure to invoke this function by passing it the NgModule created by Angular |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the formatting is not correct...
docs/ENVIRONMENTS.md
Outdated
decorateModule(moduleRef: NgModuleRef<any>): NgModuleRef<any> { | ||
// perform any module customization needed for this specific environment here | ||
// and make sure to invoke this function by passing it the NgModule created by Angular | ||
return moduleRef; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems that the formatting is not correct...
case "interactive": | ||
case "complete": | ||
default: | ||
if (this.environment.hmr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can extract this entire block to a function because it is also used in the mainWrapper
property, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed
document.removeEventListener("DOMContentLoaded", this.mainWrapper, false); | ||
|
||
if (this.environment.hmr) { | ||
if (module["hot"]) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can be changed to module.hot
to keep consistency since we use it like that in the other places in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Mh for module.hot we need to look at this task first I think: #482
// no need for the event listener after this | ||
document.removeEventListener("DOMContentLoaded", this.mainWrapper, false); | ||
|
||
if (this.environment.hmr) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering if it is better to change this check to use the ambient ENV variable. This way the code inside will be removed in PROD. But in order for this to works, then we should also add this check inside the bootstrapHmr
method so that the actual usage of the angularclass/hmr
module is also removed from the bundle.
What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, let's keep it light :)
* Reference: https://github.com/gdi2290/angular-hmr | ||
* @ignore | ||
*/ | ||
protected bootstrapHmr: any = (module: any, bootstrap: () => Promise<NgModuleRef<any>>) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you can change the type of this to Function ;)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup!
I'll try to look at this soon, not sure when I'll be able to though :) |
4e70125
to
83f41e9
Compare
83f41e9
to
d8151c8
Compare
fix(stark-core): complementary fixes for feature/bootstrap
PR recreated |
Closes #112 #412
PR Checklist
Please check if your PR fulfills the following requirements:
PR Type
What kind of change does this PR introduce?
What is the current behavior?
Issue Number: N/A
What is the new behavior?
Does this PR introduce a breaking change?
Other information