webpack-encore: enableVueLoader does not include VueLoaderPlugin?
When trying to compile code with Vue-loader, I get a bunch of the following error:
vue-loader was used without the corresponding plugin. Make sure to include VueLoaderPlugin in your webpack config.
When I manually add the VueLoaderPlugin in my webpack.config.js, I get the following error:
Module build failed: ReferenceError: [BABEL] /Users/bgore/Sites/demads.test/public_html/assets/js/organization/Advertiser.vue: Unknown option: base.omit. Check out http://babeljs.io/docs/usage/options/ for more information about options. A common cause of this error is the presence of a configuration options object without the corresponding preset name
I imagine this is a problem with my local setup, probably not a bug, but I’m not sure. I can’t seem to find anything about this on the wider web.
Config file looks thus:
const { VueLoaderPlugin } = require('vue-loader')
var Encore = require('@symfony/webpack-encore');
Encore
// Project directory where assets will be stored
.setOutputPath('assets/build')
// public path used by the web server
.setPublicPath('/assets/build')
// Enable Source maps in dev
.enableSourceMaps(!Encore.isProduction())
// Cleanup output dir before build
.cleanupOutputBeforeBuild()
// Show notications
.enableBuildNotifications()
// Enable SASS/SCSS compilation
.enableSassLoader()
// Enable Vue SFC compilation
.enableVueLoader()
// Tried with and without this
.addPlugin(new VueLoaderPlugin())
.addEntry('organization/advertiser', './assets/js/organization/advertiser.js');
module.exports = Encore.getWebpackConfig();
Install was done exactly as described on the Symfony site.
Any pointers are greatly appreciated.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 13
- Comments: 18 (1 by maintainers)
Hi @thebravecowboy,
You probably use
vue-loader
v15 which was released yesterday and introduces a lot of changes compared to v14. One of these changes is that you have to use an extra plugin:VueLoaderPlugin
(that’s not handled yet by Encore).I’m not sure what causes the issue you’re having (we don’t set that
base.omit
option… maybe it’s related to the content of yourAdvertiser.vue
file?) but there’s a chance that we’ll have to make some modifications in order to support that version of thevue-loader
.In the meantime could you try removing your version of the
vue-loader
/VueLoaderPlugin
and addingvue-loader@^14.2.2
instead?https://github.com/vuejs/vue-loader/tree/next
vue-loader v15 has major breaking changes. If your vue-loader version is 15 and above ,you should add VueLoaderPlugin like this in your webpack config:
An easy peasy fix if you’re using Vue-Loader v15 and above: Update your
webpack.config.js
And that’s it! Here’s the working source code and the Reference Tutorial.
I think the new
vue-loader
is not very stable yet. It’s better to wait a bit for the stabilization.@damien-roche I meant
vue-loader@^14.2.2
(the plugin isn’t needed for v14 and is part of that same package in v15).Please consider adding this to the docs until it’s fixed 😉
Right now following instructions at https://symfony.com/doc/current/frontend/encore/vuejs.html just leads to a non-working environment without pointer as to how to fix it as it loads v15 by default.
Yep, finally got there 😃 cheers
Lovely:
Fun times.