Skip to content

Eliminate unnecessary js files only load files needed #33686

Open
@mrtuvn

Description

@mrtuvn

Description (*)

Not a bug but i think we should consider remove/reduce un-need js load files to make site render faster. Current magento have many js loaded via requirejs (~190 files) in case no bundling enabled

"simplify js only keep common parts we used and remove not used parts"

Common files we can consider keep at all page (for basic make site workable)
underscore
requirejs
jquery
knockoutJs
cookie
storage
translate
main
common
utils
section-config.js
mixins.js

Ko bindings and all js related ko dependencies should be simply

i18n <= common
scope <= common
mage-init <= common
after-render <= common
resizable <= common
bind-html <= common
knockoutjs/knockout-repeat <= common
knockoutjs/knockout-fast-foreach <= common

uncommon ko-bind
keyboard
optgroup
range
autoselect
datepicker
outer_click
fadeVisible
collapsible
staticChecked
simple-checked
tooltip
color-picker

Uncommon files (Load on demands default)
ie-class-fixer.js (IE nearly dead and not support) we should replace/remove this REMOVED
smart-keyboard-handler.js
lib/logger/logger.js
lib/logger/console-output-handler.js (should only visible in developer or debug purpose? Why we load it in production mode for show log bug)
jquery widget ui effects: No need fancy stuff we only some basic fade, show/hide, toggle => reduce it
v.v.

Extra
By default all js loaded by requirejs will load with async mode but some case we don't want that. Would be great if we have config or option allow admin to choose async/defer load requirejs depend from backend
Not the case add js via layout (with defer attribute)

Expected behavior (*)

Faster render website with minimal amount js
I think around 20-30 js files or less files would be great and bring to user/visiter better experiences

Benefits

Yes of course this is good improvements. No one want to have slow experiences while visit ecommerce store

Additional information

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions