Webpacker: Module parse failed - .vue files

Created on 20 Dec 2017  路  11Comments  路  Source: rails/webpacker

Hi,
I am currently facing a very strange issue. I am currently trying to import a .vue file in one of my .js packs. For some reason, whenever i try to import the said .vue file, the following error message is displayed:
image

I really do not understand where this error may be coming from as I was using .vue components without any issues in a previous project with a similar configuration. The only configuration change I made was to add the following in my environment.js:

module.exports = { resolve: { alias: { components: '/components', utilities: '/utilities' } } }

I would highly appreciate if someone could help me on this one.
Thanks!!!

More info:
Failing line:
image

Component i am trying to load:
image

Most helpful comment

Great thanks!!! Updating webpacker to 3.2 and running the following commands did the trick (and seriously reduced the size of generated .js packs):
bundle update webpacker
yarn upgrade @rails/webpacker
bundle exec rails webpacker:install:vue

Thanks a lot for your help!!!

All 11 comments

Are you using the latest version of webpacker?

If yes, you would need to copy vue loader or run vue install to add the loader to environment.js: https://github.com/rails/webpacker/blob/master/CHANGELOG.md#breaking-changes

No, i am using version 3.0.2 with rails 5.1.1 which was the same setup in my previous working project. Would updating my webpacker version do the trick?

Don't think it's using 3.0.2 atleast for node module. If you want to use 3.0.2, could you please install like so:

yarn add @rails/[email protected]

Would updating my webpacker version do the trick?

The latest version has extracted vue loader into user space so you would need to add it either though installer or manually as explained in the Changelog.

Great thanks!!! Updating webpacker to 3.2 and running the following commands did the trick (and seriously reduced the size of generated .js packs):
bundle update webpacker
yarn upgrade @rails/webpacker
bundle exec rails webpacker:install:vue

Thanks a lot for your help!!!

Awesome 馃憤

Too bad because it's bug in a fresh Rails 5.1.4 release :(

Would there have been any other way to solve the issue?

What's the issue? thought it was resolved earlier

No worries it's indeed solved, just asking the question to woto out of curiosity :)

Was this page helpful?
0 / 5 - 0 ratings