magento / magento/m2-devtools

Idea: Estimate bundle sizes

Open
#19 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
171
Forks
47
PR merge metrics
No merged PRs in 30d

Description

This issue is a:

  • Bug
  • Feature suggestion
  • Documentation issue
  • Other (Please Specify)
Environment
Question Answer
Magento version N/A
Browser + version N/A
node.js version (node -v) N/A
npm version (npm -v) N/A

Description

When recording in the RequireJS tab is completed, a user of this extension is presented with a configuration they can use with the RequireJS Optimizer.

At that time, we have the following data:

In a bundled file, the RequireJS Optimizer only makes 1 change to each included AMD module: it adds a string literal as the first value in the define call.

I suspect we could get a decent estimate of a final bundle's size by:

  1. Collecting all resources that will be in the bundle
  2. Concatenating all those sources together
  3. Running the result through uglifyjs2 (used by the RequireJS Optimizer)

Expected result:

Either one of 2 results should come from this issue:

  • Bundle size estimates are included in the Bundle Generation tool
  • It's determined the estimates will be too incorrect to be useful

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the RequireJS tab and Bundle Generation tool, where the bundle module lists and raw sources are available. Check whether concatenating those resources and passing them through uglifyjs2 produces useful estimates. Done means either displaying estimates in Bundle Generation or documenting that the results are too inaccurate to use.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js, typescript
Domain
tooling
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.