Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(closure): make root.ts work with closure (#2546)
1) don't throw at top-level scope. Closure compiler does not allow this if a goog.module statement is present in the file. We need this modification to use RxJS with angular/tsickle. Addresses angular/tsickle#420 2) refactor the conditional logic for finding the root object See alexeagle/closure-compiler-angular-bundling#15 Closure seems to statically reduce the existing code and eliminates the conditional, making it always throw.
- Loading branch information
0ecf55d
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.
As of 2017-05-09, this change in rxjs 5.3.2 breaks Angular 4.1.1 + Angular-CLI 1.0.2 with the following error during a simple ng version call:
RxJS could not find any global context (window, self, global)
Error: RxJS could not find any global context (window, self, global)
at C:\projects\APM-Routed\node_modules@angular\cli\node_modules\rxjs\util\root.js:15:11
at Object. (C:\projects\APM-Routed\node_modules@angular\cli\node_modules\rxjs\util\root.js:16:3)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (C:\projects\APM-Routed\node_modules@angular\cli\node_modules\rxjs\Observable.js:2:14)
I look forward to the respective teams (Angular, Angular-CLI, rxjs) working quickly to resolve this issue.