best practice for large (2M~) bundles for Rails 5/6 and Webpacker?

Viewed 160

For my rails app, the webpacker-bundled application.js is already too large (~2M) because of jquery, quill, and some other js dependencies. Currently, I am bundling everything into a single js file, which is loaded by every HTML page. As a result, the page loading time is not acceptable.

So I am thinking of a few methods to fix this problem:

  1. generate different application.js for different layouts.
  2. use webpack externals for jquery, quill, and some other dependencies.

Are these the best options? Any suggests?

0 Answers
Related