chooser icon indicating copy to clipboard operation
chooser copied to clipboard

Audit code and reduce build size

Open brylie opened this issue 3 years ago • 3 comments

While building the Chooser as a component, there are several asset size limit warnings, such as the following:

warning

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance. Assets: license-chooser.min.js (1.75 MiB)

warning

entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. Entrypoints: license-chooser (2.51 MiB) license-chooser.js

Task

  • [ ] audit the chooser codebase to look for any code or dependencies that can be removed to reduce the bundle size
  • [ ] determine if an alternative project configuration, such as tree-shaking, might be implemented to reduce bundle size
  • [ ] discuss findings to determine which changes to make
  • [ ] make desired changes to reduce bundle size

brylie avatar Jan 26 '22 08:01 brylie

Hello @brylie, I'm working on this issue...

DanielGraham123 avatar Sep 05 '22 10:09 DanielGraham123

I will be working on this issue

PeaceOffiong avatar Oct 12 '22 09:10 PeaceOffiong

Hi @PeaceOffiong , I would love to assist you in working on this if you do not mind.

JeffyDave avatar Oct 13 '22 10:10 JeffyDave

@possumbilities @TimidRobot Shall I pick up this issue?

Cronus1007 avatar Feb 23 '23 17:02 Cronus1007

@Cronus1007 feel free to tackle it, and thankyou! ❤️

possumbilities avatar Feb 28 '23 14:02 possumbilities

@possumbilities Unused dependencies which I was able to find are

  1. bulma
  2. core-js
  3. sass
  4. clipboardy
  5. eslint-plugin-prettier

While running npm run build-component it gives

warning

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB). This can impact web performance. Assets: license-chooser.min.js (1.25 MiB)

warning

entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance. Entrypoints: license-chooser (1.79 MiB) license-chooser.js

Screenshots

Screenshot from 2023-03-12 21-47-47

Cronus1007 avatar Mar 12 '23 16:03 Cronus1007

@Cronus1007 I could be wrong, but could you provide more info. It seems like several of those are in use in the dependency chain somewhere.

I thought clipboardy was how the clipboard copy works within the Chooser. I thought the sass and bulma dependencies are necessary for the app/site since it's utilizing Vocabulary.

The other two I'm not sure on. Is there some kind of output or report indicating that they are indeed not used at all?

possumbilities avatar Mar 17 '23 20:03 possumbilities

@possumbilities I used the npm dependency i.e. depcheck for checking the unused dependencies. It listed several dependencies and then I went through the codebase checking out the dependencies used which took me to this conclusion. Also when I ran the project after removing these dependencies it went well. Both the serve script and build script were working as previously. I don't think any functionality has been broken due to this.

I have a solution for this let me create a branch and commit my changes you could have a look at the build of that branch and if you feel that some functionality has been broken then we can revert everything. Right now I am working on treeshaking in order to reduce the build size as well.

Cronus1007 avatar Mar 20 '23 14:03 Cronus1007

@Cronus1007 that's a good idea, I'm happy to test the branch

possumbilities avatar Mar 20 '23 19:03 possumbilities

@possumbilities Sure I am on it.

Cronus1007 avatar Mar 21 '23 03:03 Cronus1007

I would like to work on it @possumbilities if its possible please assign me

Pursottam6003 avatar Mar 31 '23 13:03 Pursottam6003