Skip to content

Global scripts lazy loading story issue #6018

@kuncevic

Description

@kuncevic

Versions.

Node 7.8.0
NPM 4.4.4
CLI: 1.0.0
OS: win7 x64

Repro steps.

Just followed the docs https://github.com/angular/angular-cli/wiki/stories-global-scripts
I am using powerbi-client in my lazy loaded component.

That is how I am using the library:

import * as pbi from 'powerbi-client'; 
...
export class PowerbiComponent implements OnInit {
     powerbi: any;
     ...
}

import * as pbi from 'powerbi-client'; is not required for component to work when powerbi.bundle.js is loaded in case "lazy": true. But just thought if it might trigger the powerbi.bundle.js to lazy load.

That is my component module:

@NgModule({
  imports: [
    CommonModule,
    PowerbiRoutingModule,
    MaterialModule,
    FormsModule,
    NgxDatatableModule,
    ReactiveFormsModule,
    FormsModule,
    HttpModule,
    SharedHttpModule.forRoot()
  ],
  declarations: [
    PowerbiComponent,
  ]
})
export class PowerbiModule {
    static forRoot(): ModuleWithProviders {
    return {
      ngModule: PowerbiModule,
      providers: []
    };
  }
}

.angular-cli.json:

 "scripts": [
    { "input": "../node_modules/powerbi-client/dist/powerbi", "output": "powerbi", "lazy": true}
],

So I got my component chunk and powerbi.bundle.js generated.
Then when I am activating the route the chunk gets loaded but powerbi.bundle.js is not, it is just never gets loaded.

Desired functionality.

Lazy loaded script bundle gets loaded before chunk is gets loaded.

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