-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Angular CLI with scripts forces displaying of only stat size #160
Comments
Hi! Thank you so much for creating a new issue, this makes tracking this case much easier I tagged this as a "feature" for now, as We'll get to this issue when we have time. On a quick glance, it seems that we've got enough information to be able to figure out a good strategy on fixing this case |
Can verify that although version 6 of Angular CLI brings in a lot of changes, this remains an issue even with version 6. So a fresh @angular/cli project (like this one) still has no issues but upon adding a script in the scripts array of the Technical info
|
@Koslun Would you mind sharing a specific example of the "loading the script through an npm package" workaround? |
@byrondover Think I said that incorrectly actually. I rather instead loaded it as a script tag in
I then additionally used a separate npm package to fire off an event in Google analytics: https://github.com/angulartics/angulartics2#minimal-setup-for-google-analytics. But I didn't specifically actually need to an npm package in this case. My experience is however that most JavaScript libraries are also available on npm in which case you should be able to just |
Should be fixed in |
Issue description
When using the webpack-bundle-analyzer in conjunction with the Angular CLI there is an issue with parsing the
scripts.[hash].bundle.js.
When specifying scripts to put in the script bundle via the .angular-cli.json those scripts get concatenated and not wrapped in any webpack functionality like "
webpackJsonp(
". This appears to result in a parsing error with the webpack-bundle-analyzer which in turn causes all chunks to go off the stats.json making it so you can't see parsed or gzipped sizes when using the tool.To reproduce this issue please use this repo
For extra information surrounding this issue (and some ideas on ways to tackle it) you can view the last couple of comments from this isssue/thread.
To "fix" it locally you can do the following:
The relevant parts of the stats.json to remove are-
"assetsByChunkName": { "inline": "inline.86cf029305c934704a61.bundle.js", "main": "main.66983cb30db00a1c5598.bundle.js", "polyfills": "polyfills.dc963f90580f1044b785.bundle.js", "styles": "styles.9c0ad738f18adc3d19ed.bundle.css", - "scripts": "scripts.d464be456471b1b5f048.bundle.js" }
and
Which effectively excludes that chunk from being analyzed.
Technical info
Debug info
How do you use this module? As CLI utility or as plugin? CLI
If CLI, what command was used? (e.g.
webpack-bundle-analyzer -O path/to/stats.json
)webpack-bundle-analyzer dist/stats.json
If plugin, what options were provided? (e.g.
new BundleAnalyzerPlugin({ analyzerMode: 'disabled', generateStatsFile: true })
)N/A
What other Webpack plugins were used?
Default Angular CLI.
Stats.json
The stats.json can be generated by using the example reproduction repo.
The text was updated successfully, but these errors were encountered: