I see that javascript contributes a lot to my magento2 page weight (1 mb).

I wonder if it could be optimized with r.js when deploying static content or magento2 already uses an optimization tool.

Does anyone have any experience with that?

1 Answer 1


Yes. It could be optimized by using r.js

  • Anton Krill showed a basic implementation here https://github.com/antonkril/magento-rjs-config - however Magento team is working on new external bundling solution - but I guess it will still take some time
  • Shane Osbourne from JH is using r.js with their own way implementation in Magento 2 projects - he created config-gen tool to help devs create build.js file for requirejs optimizer to create bundles - https://github.com/WeareJH/config-gen

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.