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

Created on 27 Apr 2018  路  7Comments  路  Source: vuejs/vue-loader

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)

Most helpful comment

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

All 7 comments

Please don't use CodeSandbox for repos... it doesn't use the latest vue-loader and we cannot look into actual configurations.

Nvm, I see it's not using the default boilerplate ;)

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

Thank you for commenting at all and sorry for wasting your time. I must've been blind.

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')

@kevinmpowell they are equivalent.

Nice and consistent:

const TerserPlugin = require("terser-webpack-plugin");
const CaseSensitivePathsPlugin = require("case-sensitive-paths-webpack-plugin");
const FriendlyErrorsWebpackPlugin = require("friendly-errors-webpack-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const PreloadPlugin = require("preload-webpack-plugin");
const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
const CopyPlugin = require("copy-webpack-plugin");
const { VueLoaderPlugin } = require("vue-loader")

:-S

Was this page helpful?
0 / 5 - 0 ratings

Related issues

flashios09 picture flashios09  路  3Comments

matt-sanders picture matt-sanders  路  4Comments

fuyan-run picture fuyan-run  路  3Comments

chrisvfritz picture chrisvfritz  路  4Comments

NextSeason picture NextSeason  路  3Comments