Skip to content
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

[Feature] Get bundle filename by bundle name, lazy styles / scripts #8831

Closed
1 task done
Epenance opened this issue Dec 11, 2017 · 9 comments
Closed
1 task done

[Feature] Get bundle filename by bundle name, lazy styles / scripts #8831

Epenance opened this issue Dec 11, 2017 · 9 comments
Labels
area: @angular-devkit/build-angular feature Issue that requests a new feature
Milestone

Comments

@Epenance
Copy link

  • Feature request

Desired functionality.

In #3401 the functionality to add new style bundles and set them to lazy load making them not automatically included in the app was added, and it works great! However it is currently impossible to predict the hash of the files, forcing you to disable output-hashing if you want to be able to load it yourself into the application.

It would be great to have a function of sorts where we could fetch the file name of the bundle by supplying the bundle name.

angular-cli.json example:

"prefix": "app",
"styles": [
  { "input": "scss/red.scss", "output": "red", "lazy": true },
  { "input": "scss/blue.scss", "output": "blue", "lazy": true },
  { "input": "scss/green.scss", "output": "green", "lazy": true },
  { "input": "scss/yellow.scss", "output": "yellow", "lazy": true }
],

It would be great to have something in the way of:

const filename = this.cli.getStyleBundleByName('red);

Or something similar.

@Epenance
Copy link
Author

Another solution could be to add a flag to generate a assets.json file that only contains the asset file names. I tried doing this with the --stats-json file but it is more than 17mb big making it not such a good solution.

@Brocco Brocco added the feature Issue that requests a new feature label Dec 11, 2017
@deebloo
Copy link
Contributor

deebloo commented Dec 13, 2017

@Epenance I wouldn't limit this to style bundles but script bundles as well.

@Epenance
Copy link
Author

@deebloo I agree.

@filipesilva
Copy link
Contributor

The script bundles currently don't have the hash, but the styles do unfortunately. This is a bug but we haven't found a good way to fix it.

@filipesilva filipesilva added help wanted P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix and removed feature Issue that requests a new feature labels Dec 21, 2017
@filipesilva filipesilva self-assigned this Dec 21, 2017
@Epenance
Copy link
Author

@filipesilva I see, I personally dont think the hash itself is a bad thing, as long as there is a way to know it, its good for invalidating caches :)

@xmlking
Copy link

xmlking commented Feb 4, 2018

I also discovered this need while trying to implementing lazy loaded themes like https://material.angular.io/

meanwhile an implementation of when "hash": false set, prevent from generating hash would be helpful.

"prefix": "app",
"styles": [
  { "input": "scss/red.scss", "output": "red", "lazy": true , "hash": false},
  { "input": "scss/blue.scss", "output": "blue", "lazy": true , "hash": false},
  { "input": "scss/green.scss", "output": "green", "lazy": true , "hash": false},
  { "input": "scss/yellow.scss", "output": "yellow", "lazy": true , "hash": false}
],

we need hashing for rest of the files for cache busting.

a potential temp solution is enabling service-workers and finding hash from ngsw.json

@filipesilva filipesilva added feature Issue that requests a new feature comp: cli/build and removed help wanted P3 An issue that is relevant to core functions, but does not impede progress. Important, but not urgent type: bug/fix labels Feb 14, 2018
@shiptoncraig
Copy link

Encountered the same problem when trying to lazy load assets manually too, without sacrificing bundle hashes.

Even just having a manifest/assets json file, output within /dist, that just included "assetsByChunkName" from stats.json would go a long way.

@filipesilva
Copy link
Contributor

We've since remove hashes from the lazy bundles so I think this is solved.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular-devkit/build-angular feature Issue that requests a new feature
Projects
None yet
Development

No branches or pull requests

7 participants