fix: use friendly-errors plugin in client only to prevent duplicate error messages

This commit is contained in:
Pooya Parsa 2018-03-23 13:23:59 +04:30
parent b70ff8710f
commit 40541fdc5e
2 changed files with 11 additions and 11 deletions

View File

@ -1,6 +1,5 @@
import path from 'path' import path from 'path'
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
import TimeFixPlugin from 'time-fix-plugin' import TimeFixPlugin from 'time-fix-plugin'
import webpack from 'webpack' import webpack from 'webpack'
import _ from 'lodash' import _ from 'lodash'
@ -215,16 +214,6 @@ export default class WebpackBaseConfig {
plugins.push(new StatsPlugin(this.options.build.stats)) 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 return plugins
} }

View File

@ -5,6 +5,7 @@ import HTMLPlugin from 'html-webpack-plugin'
import BundleAnalyzer from 'webpack-bundle-analyzer' import BundleAnalyzer from 'webpack-bundle-analyzer'
import MiniCssExtractPlugin from 'mini-css-extract-plugin' import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import UglifyJsWebpackPlugin from 'uglifyjs-webpack-plugin' import UglifyJsWebpackPlugin from 'uglifyjs-webpack-plugin'
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
import VueSSRClientPlugin from './plugins/vue/client' import VueSSRClientPlugin from './plugins/vue/client'
import WebpackBaseConfig from './base' 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 // Extend config
if (typeof this.options.build.extend === 'function') { if (typeof this.options.build.extend === 'function') {
const isDev = this.options.dev const isDev = this.options.dev