Rails 5.2, webpacker and vue-loader v15+

Just a quick fix for vue-loader v15+

If you're developing in Rails in 2018, you're likely using a webpack and a front end framework. This will help you get your vue-loader going from complaining about needing a special loader to compile, back to working.

In your project open up /app/config/webpack/environment.js

const { environment } = require('@rails/webpacker')
const vue = require('./loaders/vue')

environment.loaders.append('vue', vue)
module.exports = environment

You'll probably see something like above.

You'll want to be sure to run yarn add vue-loader and double check in your package.json that your version is v15 or above.

Add these few lines to your environment.js and you'll be back to compiling:

const { environment } = require('@rails/webpacker')
const VueLoaderPlugin = require('vue-loader/lib/plugin')
const vue = require('./loaders/vue')

environment.loaders.append('vue', vue)
environment.plugins.append('VueLoaderPlugin', new VueLoaderPlugin())
module.exports = environment

Further reading: https://github.com/rails/webpacker/blob/master/docs/webpack.md#plugins