How to Completely Remove Webpack and All Its Dependencies from Rails App

How to completely remove webpack and all its dependencies from Rails App

  • remove bin/webpackor run bundle exec rake rails:update:bin
  • remove config/webpacker.yml
  • remove config/webpack
  • remove app/javascripts
  • remove config.webpacker.check_yarn_integrity = false from config/{development, test, production}.rb
  • verify that you don't have webpacker in your gemfile and run bundle install or bundle clean

imho, don't create your rails app with generators (unless it's your own)

Rails - How to remove vue.js with webpack

webpacker v5 currently doesn't have uninstall support, so you'd have to manually undo the install:vue command's actions:

  1. Remove vue loader from config/webpack/loaders: Delete <rootDir>/config/webpack/loaders/vue.js

  2. Remove vue loader: In <rootDir>/config/webpack/environment.js:

    a. delete const { VueLoaderPlugin } = require('vue-loader')

    b. delete environment.plugins.prepend('VueLoaderPlugin', new VueLoaderPlugin())

    c. delete const vue = require('./loaders/vue')

    d. delete environment.loaders.prepend('vue', vue)

  3. Remove .vue file extension support from Webpack config: In the Webpacker config file, delete - .vue

  4. Remove example entry file: Delete <srcDir>/hello_vue.js

  5. Remove Vue app file: Delete <srcDir>/app.vue

  6. Uninstall Vue dependencies: From <rootDir>, run yarn remove vue vue-loader vue-template-compiler

How to remove Yarn from a Rails app completely?

When you create a rails project, you can add --skip-yarn as rails new app_path --skip-yarn.

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

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.

Unable to build and deploy Rails 6.0.4.1 app on heroku - Throws gyp verb cli error

I had a similar problem but resolved by following steps.

  1. Run the following command. heroku buildpacks:add heroku/nodejs --index 1
  2. Update node version from 16.x to 12.16.2 in package.json.


Related Topics



Leave a reply



Submit