Skip to content

scripts in angular.json not loaded after upgrading to 0.801.0-rc.0 [Ivy] #14956

Description

@sfabriece

🐞 Bug report

Command (mark with an x)

- [ ] new
- [ ] build
- [X] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Is this a regression?

Yes, the previous version in which this bug was not present was: 0.801.0-beta.3

Description

Before upgrading @angular-devkit/build-angular to 0.801.0-rc.0, scripts defined in angular.json were loaded in the global scope and I could access them in components.

Now I get ERROR ReferenceError: lottie is not defined

🔬 Minimal Reproduction

change @angular-devkit/build-angular to ~0.801.0-rc.0
add "lottie-web": "5.5.5" to your dependencies
add script to angular.json

 "scripts": [
              "./node_modules/lottie-web/build/player/lottie.js"
            ]

try accessing lottie in a component:

declare const lottie: any;
@Component({})
export class x{
 ngAfterViewInit() {
    console.log(lottie);
 }
}

🔥 Exception or Error




ERROR ReferenceError: lottie is not defined
    at RecruitingComponent.ngAfterViewInit (x.component.ts:29)
    at callHook (core.js:5462)
    at callHooks (core.js:5426)
    at executeHooks (core.js:5377)
    at leaveView (core.js:6017)
    at renderComponentOrTemplate (core.js:14511)
    at tickRootContext (core.js:15863)
    at renderEmbeddedTemplate (core.js:14447)
    at refreshDynamicEmbeddedViews (core.js:15691)
    at refreshDescendantViews (core.js:14107)

🌍 Your Environment




Angular CLI: 8.1.0-rc.0
Node: 12.4.0
OS: win32 x64
Angular: 8.1.0-rc.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router, service-worker

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.0-rc.0
@angular-devkit/build-angular     0.801.0-rc.0
@angular-devkit/build-optimizer   0.801.0-rc.0
@angular-devkit/build-webpack     0.801.0-rc.0
@angular-devkit/core              8.1.0-rc.0
@angular-devkit/schematics        8.1.0-rc.0
@angular/pwa                      0.800.6
@ngtools/webpack                  8.1.0-rc.0
@schematics/angular               8.0.6
@schematics/update                0.801.0-rc.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.35.0

Anything else relevant?

windows 10
Ivy enabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions