Prerequisites to install the Webpacker gem
* Ruby 2.2+ * Rails 4.2+ * Node.js 6.14.4+ * Yarn 1.x+
Step 1. Create a new Rails App. Run the command
rails new rails-webpack-vue
Step 2. Add gem ‘webpacker’ in the gem file, and later run bundle install
Step 3. After installing webpacker gem, run the command rails webpacker::install.
Step 4. Run the command bin/webpack-dev-server.
Step 6. Generate one controller with rails scaffold for example, rails g scaffold Company name: string address: string
Step 7. Run localhost:3000/companies.Inspect the browser you will get a message in console “Hello from webpacker” .For now, Webpacker is working. Next step is to install Vue.js
Step 8: Run rails webpacker:install:vue
You can change your entry point for your frontend files in webpacker.yml, there you have to specify the source_path you want to give and restart the webpack-dev-server. You can also specify the path for additional modules you want to lookup by webpack in an array in resolved_paths.