refactor(upgrade): rename module constant to avoid webpack bug (#30058)

When targeting ES2015 (as is the default in cli@8), `const` is not
downleveled to `var` and thus declaring `const module` throws an error
due to webpack wrapping the code in a function call with a `module`
argument (even when compiling for the `web` environment).

Related: webpack/webpack#7369

Fixes #30050

PR Close #30058
This commit is contained in:
George Kalpakas
2019-04-23 18:00:04 +03:00
committed by Andrew Kushnir
parent a9379e0ed2
commit abcb2cf9a0
13 changed files with 192 additions and 189 deletions

View File

@ -296,7 +296,9 @@ export function getAngularJSGlobal(): any {
export const bootstrap: typeof angular.bootstrap = (e, modules, config?) =>
angular.bootstrap(e, modules, config);
export const module: typeof angular.module = (prefix, dependencies?) =>
// Do not declare as `module` to avoid webpack bug
// (see https://github.com/angular/angular/issues/30050).
export const module_: typeof angular.module = (prefix, dependencies?) =>
angular.module(prefix, dependencies);
export const element: typeof angular.element = (e => angular.element(e)) as typeof angular.element;