simonihmig / ember-cli-bundle-analyzer

Analyze the size and contents of your Ember app's bundles
MIT License
99 stars 2 forks source link

Ember.js appears multiple times #58

Closed NullVoxPopuli closed 4 years ago

NullVoxPopuli commented 4 years ago

https://emberclear.io/bundle/broccoli.html

simonihmig commented 4 years ago

Should be fixed by #70, released as v0.2.1!

NullVoxPopuli commented 4 years ago

if I have broccoli-concat-analyser installed instead of ember-cli-bundle-analyzer, how do I get the fix? ;)

NullVoxPopuli commented 4 years ago

can ember-cli-bundle-analyzer be invoked via CLI?

NullVoxPopuli commented 4 years ago

my use case:

GH action:

  bundle_analysis:
    name: Bundle Analysis
    runs-on: ubuntu-latest
    timeout-minutes: 10

    steps:
    - uses: actions/checkout@v2
    - uses: rwjblue/setup-volta@v1

    - name: Install
      working-directory: ${{ env.cwd }}
      run: yarn install

    - name: Analyze Bundle
      working-directory: ${{ env.cwd }}
      run: yarn analyze
      # ^ this runs the script below

    - name: Upload Bundle Analysis Artifacts
      uses: actions/upload-artifact@v1
      with:
        name: built_bundle_analysis
        path: packages/frontend/public/bundle

(the artifacts are then downloaded later and merged with the regular app build during deployment)

#!/bin/bash
# yarn analyze runs this

R="\e[31m"
Y="\e[33m"
N="\e[0m"

# outputs the following files:
# - concats-stats-for/
#   - #-emberclear.js.json
#   - #-vendor.js.json
#   - #-vendor.css.json
#   - ember-auto-import.json
#
rm -rf public/bundle

CONCAT_STATS=true yarn build:production

# begin analysis
yarn bundle-analyze
# alias for:
# "bundle-analyze": "yarn broccoli-concat-analyser ./concat-stats-for",

# copy to public folder for deployment
mkdir -p ./public/bundle
cp ./concat-stats-for/index.html ./public/bundle/broccoli.html
cp ./concat-stats-for/ember-auto-import.html ./public/bundle/
# copy from dist to public, because we build one more time without CONCAT_STATS
cp ./dist/bundle/* ./public/bundle/
simonihmig commented 4 years ago

@NullVoxPopuli in #70 I simply ignore 'ember.js' as a bundle. broccoli-concat-analyser as a library has the option to ignore files (https://github.com/stefanpenner/broccoli-concat-analyser/blob/master/lib/summarize-all.js#L17), which this addon uses under the hood. But broccoli-concat-analyser as a CLI does not currently. (https://github.com/stefanpenner/broccoli-concat-analyser/blob/master/lib/cli.js)

NullVoxPopuli commented 4 years ago

it works! thanks! <3

https://github.com/NullVoxPopuli/emberclear/pull/837