Webpacker: vue-loader v15 requires VueLoaderPlugin in webpack config

Created on 26 Apr 2018  路  8Comments  路  Source: rails/webpacker

Most helpful comment

For anyone going crazy about matching thirty-thousand different front-end packages versions in order to avoid some random undocumented compatibilities on a nightly-bleeding-edge new release of a peerDependency that you had to randomly install on a blue moon in 1834, it needs the following in your webpack.config.js

const VueLoaderPlugin = require('vue-loader/lib/plugin')
...
plugins: [
  new VueLoaderPlugin()
]

All 8 comments

For anyone reading, the temporary solution is to downgrade to v14.2.2

For webpacker 3:
yarn upgrade [email protected]

For webpacker 4.x:

  1. At environment.js, comment out VueLoaderPlugin environment.plugins.append('VueLoaderPlugin', new VueLoaderPlugin())
  2. Then run yarn upgrade [email protected]

@rlafranchi thanks for reporting!

plugins: [
new VueLoader.VueLoaderPlugin()
]

A better temporary solution since vue-loader v15 fixes a bunch of bugs including the css-out-of-order in production bug is to add to environment.js

// environment.js

// Required for vue-loader v15
const VueLoaderPlugin = require('vue-loader/lib/plugin')
environment.plugins.append(
  'VueLoaderPlugin',
  new VueLoaderPlugin()
)

module.exports = environment

What's the permanent solution? 馃槃 Did we fix this in 4.x?

Yup, it's fixed in 4.x but the user has to choose the latest vue-loader at rails webpacker:install:vue.
screenshot 2018-10-06 11 54 41

perhaps use vue-loader instead of vue-loader@next?

@bbugh solution seems to mostly work for me, although I also had to append a new rule into the webpack config that targets vue (or I suppose I was supposed to always be doing this and simply dropped the ball). But... that custom loader seems like it results in my vue loader not respecting my .babelrc plugin of 'transform-class-properties', which causes my app to break on IE11 because of arrow functions. Not sure yet what to do about that.

// Necesary configuration for vue-loader v15
const VueLoaderPlugin = require('vue-loader/lib/plugin');
environment.plugins.append(
    'VueLoaderPlugin',
    new VueLoaderPlugin()
);
environment.loaders.append('vue', {
    test: /\.vue$/,
    loader: 'vue-loader'
});

Please try the latest RC, otherwise feel free to open a new issue with more details.

For anyone going crazy about matching thirty-thousand different front-end packages versions in order to avoid some random undocumented compatibilities on a nightly-bleeding-edge new release of a peerDependency that you had to randomly install on a blue moon in 1834, it needs the following in your webpack.config.js

const VueLoaderPlugin = require('vue-loader/lib/plugin')
...
plugins: [
  new VueLoaderPlugin()
]
Was this page helpful?
0 / 5 - 0 ratings

Related issues

naps62 picture naps62  路  3Comments

itay-grudev picture itay-grudev  路  3Comments

ilrock picture ilrock  路  3Comments

suhomozgy-andrey picture suhomozgy-andrey  路  3Comments

ytbryan picture ytbryan  路  3Comments