-
Notifications
You must be signed in to change notification settings - Fork 12k
Global scripts lazy loading story issue #6018
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
Comments
The lazy option doesn't actually lazy load anything. It just prevents it from being executed on application startup. |
@clydin i c, so say if you do Form the docs:
How would you lazy load it? |
In this case, I would import it in the files where it is used and let the bundling system take care of it. |
Currently exploring the script element option by looking in to here http://stackoverflow.com/questions/34489916/load-external-js-script-dynamically-in-angular-2 |
There really isn't an easy way to deal with that. Making it not hash is actually on my todo list. But I have yet to find a need for the lazy option so it's not something I'll be able to get to anytime soon. From looking at the package you're trying to use, there's no need to add it as a script. The import should be sufficient (and handles all the bundling/loading details). |
If I got it imported like that: So the real question is how would you manage That is the library https://github.com/Microsoft/PowerBI-JavaScript I am using, that is how its typedefs is look like https://github.com/Microsoft/PowerBI-JavaScript/blob/master/dist/powerbi.d.ts I am importing from. |
We usually reserve the scripts array for legacy stuff that needs to be loaded as is. In your case, you seem to want to lazy load a TS lib you want to use as an import. The easiest way imho is to put that component in a lazy loaded route (https://angular.io/docs/ts/latest/guide/router.html#!#lazy-loading-route-config). One thing to note is that you need to use relative paths in |
@filipesilva Now I have multiple lazy loaded components in my app and have no issues with any other libraries except this one. Without having it in |
I can't help you much with that library, I haven't ever used it nor do I know how it's setup to be used. You can try asking in their issue tracker or Stack Overflow, those are places where you're more likely to get a good answer. |
@filipesilva Hello We want suppor LTR and RTL direction in our app. So we have 2 scss files: In angular CLI we add it like So how can we get names of our css files ? Thanks in advance. |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
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';
is not required for component to work whenpowerbi.bundle.js
is loaded in case"lazy": true
. But just thought if it might trigger thepowerbi.bundle.js
to lazy load.That is my component module:
.angular-cli.json:
So I got my component
chunk
andpowerbi.bundle.js
generated.Then when I am activating the route the
chunk
gets loaded butpowerbi.bundle.js
is not, it is just never gets loaded.Desired functionality.
Lazy loaded script bundle gets loaded before
chunk
is gets loaded.The text was updated successfully, but these errors were encountered: