From 40541fdc5e7c5413210e91ede3e2d82aa36aef4e Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 23 Mar 2018 13:23:59 +0430 Subject: [PATCH] fix: use friendly-errors plugin in client only to prevent duplicate error messages --- lib/builder/webpack/base.mjs | 11 ----------- lib/builder/webpack/client.mjs | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lib/builder/webpack/base.mjs b/lib/builder/webpack/base.mjs index 52cc915e9c..58d02de195 100644 --- a/lib/builder/webpack/base.mjs +++ b/lib/builder/webpack/base.mjs @@ -1,6 +1,5 @@ import path from 'path' -import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin' import TimeFixPlugin from 'time-fix-plugin' import webpack from 'webpack' import _ from 'lodash' @@ -215,16 +214,6 @@ export default class WebpackBaseConfig { plugins.push(new StatsPlugin(this.options.build.stats)) } - // Add friendly error plugin - if (this.options.dev) { - plugins.push( - new FriendlyErrorsWebpackPlugin({ - clearConsole: true, - logLevel: 'WARNING' - }) - ) - } - return plugins } diff --git a/lib/builder/webpack/client.mjs b/lib/builder/webpack/client.mjs index 68d9d98187..d98dc836ee 100644 --- a/lib/builder/webpack/client.mjs +++ b/lib/builder/webpack/client.mjs @@ -5,6 +5,7 @@ import HTMLPlugin from 'html-webpack-plugin' import BundleAnalyzer from 'webpack-bundle-analyzer' import MiniCssExtractPlugin from 'mini-css-extract-plugin' import UglifyJsWebpackPlugin from 'uglifyjs-webpack-plugin' +import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin' import VueSSRClientPlugin from './plugins/vue/client' import WebpackBaseConfig from './base' @@ -129,6 +130,16 @@ export default class WebpackClientConfig extends WebpackBaseConfig { ] } + // Add friendly error plugin + if (this.options.dev) { + config.plugins.push( + new FriendlyErrorsWebpackPlugin({ + clearConsole: true, + logLevel: 'WARNING' + }) + ) + } + // Extend config if (typeof this.options.build.extend === 'function') { const isDev = this.options.dev