Skip to content

Commit

Permalink
fix: ensure plugin error is emitted only once
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jun 1, 2018
1 parent b1023cd commit 0b006a3
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,17 @@ const genCustomBlocksCode = require('./codegen/customBlocks')
const componentNormalizerPath = require.resolve('./runtime/componentNormalizer')
const { NS } = require('./plugin')

let errorEmitted = false

module.exports = function (source) {
const loaderContext = this

if (!loaderContext['thread-loader'] && !loaderContext[NS]) {
if (!errorEmitted && !loaderContext['thread-loader'] && !loaderContext[NS]) {
loaderContext.emitError(new Error(
`vue-loader was used without the corresponding plugin. ` +
`Make sure to include VueLoaderPlugin in your webpack config.`
))
errorEmitted = true
}

const stringifyRequest = r => loaderUtils.stringifyRequest(loaderContext, r)
Expand Down

0 comments on commit 0b006a3

Please sign in to comment.