rails new. Follow this guide for JSBundling.
If starting a new Rails 7 app and the answer to the above question is YES, you will NOT be using the
First, read this When Rails Ejected Node and the History of Compiled JS in Rails.
Next, this post will help you understand how to get started with ImportMap-Rails.
Advantages of Not Having Node Packages
• Deployments are much smaller and faster.
• You won’t need to have a tree of node dependancies in your pipeline.
When You Will Need Bundling
• If you have transpiled Typescript or React JSX.
• If you must rely on node bundles or are targeting older browsers.
Remember, Importmap can work for modern browsers only and requires that you install “pin” your JS in one of three ways: (1) Via a CDN, (2) from the vendor folder of a Gem, or (3) from your own
If, on the other hand, you have a reason to depend on Node node modules, you will need to go with bundling.