Search code examples
ruby-on-railsrubywebpackrails-sprockets

Is it possible/advisable to run Rails 6 without webpack(er)?


I am starting a new Rails 6 application. If I understood correctly, Webpack(er) (gem webpacker) has replaced Sprockets as the new standard for including/minifying JS (source). Furthermore, Rails 6 now both requires Node.js and Yarn.

Am I correct in assuming that the Node.js and Yarn dependencies are only due to the inclusion of Webpack, or do other components of Rails 6 also need them?

Are there any possible drawbacks in removing Webpack and Node and Yarn from the Rails 6 app and continuing to use the Rails Asset Pipeline (apart from missing Webpack features)?


Solution

  • Yes, you can drop gems from Gemfile, delete the created node_modules folder and package.json file.

    After that run bundle to clean up the Gemfile.lock and start code the old way with normal views and templates. Mention, that you will have to add js engine like Google V8.

    In fact webpacker and node are not required to run a rails 6 application.