question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

vue-loader fails with TypeError: loaderContext.emitError is not a function

See original GitHub issue

Version

15.0.0

Reproduction link

https://codesandbox.io/s/34oxowywq1

Steps to reproduce

Run npm run build

What is expected?

No errors reported, or at least not from vue-loader.

What is actually happening?

vue-loader fails with the following error:

TypeError: loaderContext.emitError is not a function
    at new module.exports (/tmp/repro//node_modules/vue-loader/lib/index.js:19:19)
    at Object.<anonymous> (/tmp/repro//build/webpack.prod.conf.js:35:5)
    at Module._compile (/tmp/repro//node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (/tmp/repro//node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at WEBPACK_OPTIONS (/tmp/repro//node_modules/webpack-cli/bin/convert-argv.js:133:13)
    at requireConfig (/tmp/repro//node_modules/webpack-cli/bin/convert-argv.js:135:6)
    at /tmp/repro//node_modules/webpack-cli/bin/convert-argv.js:142:17
    at Array.forEach (<anonymous>)
    at module.exports (/tmp/repro//node_modules/webpack-cli/bin/convert-argv.js:140:15)
    at yargs.parse (/tmp/repro//node_modules/webpack-cli/bin/webpack.js:239:39)
    at Object.parse (/tmp/repro//node_modules/webpack-cli/node_modules/yargs/yargs.js:552:18)
    at /tmp/repro//node_modules/webpack-cli/bin/webpack.js:217:8
    at Object.<anonymous> (/tmp/repro//node_modules/webpack-cli/bin/webpack.js:514:3)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Module.require (internal/modules/cjs/loader.js:598:17)
    at require (internal/modules/cjs/helpers.js:11:18)
    at module.exports.filename (/home/max/.config/yarn/global/node_modules/import-local/index.js:16:66)
    at /home/max/.config/yarn/global/node_modules/webpack-cli/bin/webpack.js:13:6
    at Object.<anonymous> (/home/max/.config/yarn/global/node_modules/webpack-cli/bin/webpack.js:514:3)
    at Module._compile (internal/modules/cjs/loader.js:654:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:665:10)
    at Module.load (internal/modules/cjs/loader.js:566:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:506:12)
    at Function.Module._load (internal/modules/cjs/loader.js:498:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:695:10)
    at startup (internal/bootstrap/node.js:201:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:516:3)

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

48reactions
yyx990803commented, Apr 27, 2018

It should be const { VueLoaderPlugin } = require('vue-loader').

10reactions
kevinmpowellcommented, Jun 13, 2018

It seems this code snippet in the migration guide is incorrect: https://vue-loader.vuejs.org/migrating.html#a-plugin-is-now-required

It has const VueLoaderPlugin = require('vue-loader/lib/plugin')

Read more comments on GitHub >

github_iconTop Results From Across the Web

[VuetifyLoaderPlugin Error] No matching rule for vue-loader ...
... and adding them to the nuxt.config.js file. However after that I get another error: TypeError: loaderContext.emitError is not a function.
Read more >
loaderContext.emitError is not a function 这个是什么问题啊 ...
TypeError : loaderContext.emitError is not a function. at new module.exports (C:\Users\Administrator\Desktop\ ...
Read more >
Loader Interface - webpack
A loader is a JavaScript module that exports a function. The loader runner calls this function and passes the result of the previous...
Read more >
webpack3.x到4.x_行走的鱼儿的博客
emitError(new Error(TypeError: loaderContext.emitError is not a function 原因:vue-loader 没有引用合适,按照上图的来,其他人的答案不合适.
Read more >
webpack5 で .vueがコンパイルできず困っています。 - Qiita
[webpack-cli] Failed to load '/Users/hode/aaa/webpack.prod.js' config [webpack-cli] TypeError: VueLoaderPlugin is not a constructor at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found