mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-27 16:12:12 +00:00
refactor: add friendly-errors-webpack-plugin in both client and server
This commit is contained in:
parent
e116ff5a71
commit
010064fcf0
@ -1,6 +1,7 @@
|
||||
const TimeFixPlugin = require('time-fix-plugin')
|
||||
const WarnFixPlugin = require('./plugins/warnfix')
|
||||
const ProgressPlugin = require('./plugins/progress')
|
||||
const FriendlyErrorsWebpackPlugin = require('@nuxtjs/friendly-errors-webpack-plugin')
|
||||
|
||||
const webpack = require('webpack')
|
||||
const { cloneDeep } = require('lodash')
|
||||
@ -144,6 +145,15 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
||||
// Hide warnings about plugins without a default export (#1179)
|
||||
config.plugins.push(new WarnFixPlugin())
|
||||
|
||||
const shouldClearConsole =
|
||||
this.options.build.stats !== false &&
|
||||
this.options.build.stats !== 'errors-only'
|
||||
|
||||
// Add friendly error plugin
|
||||
config.plugins.push(
|
||||
new FriendlyErrorsWebpackPlugin({ clearConsole: shouldClearConsole })
|
||||
)
|
||||
|
||||
// Clone deep avoid leaking config between Client and Server
|
||||
return cloneDeep(config)
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ const webpack = require('webpack')
|
||||
// const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
|
||||
const VueSSRClientPlugin = require('./plugins/vue/client')
|
||||
const HTMLPlugin = require('html-webpack-plugin')
|
||||
const FriendlyErrorsWebpackPlugin = require('@nuxtjs/friendly-errors-webpack-plugin')
|
||||
const StylishPlugin = require('webpack-stylish')
|
||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||
const { resolve } = require('path')
|
||||
@ -76,15 +75,6 @@ module.exports = function webpackClientConfig() {
|
||||
)
|
||||
)
|
||||
|
||||
const shouldClearConsole =
|
||||
this.options.build.stats !== false &&
|
||||
this.options.build.stats !== 'errors-only'
|
||||
|
||||
// Add friendly error plugin
|
||||
config.plugins.push(
|
||||
new FriendlyErrorsWebpackPlugin({ clearConsole: shouldClearConsole })
|
||||
)
|
||||
|
||||
// Optimization
|
||||
config.optimization.splitChunks = {
|
||||
chunks: 'all',
|
||||
|
Loading…
Reference in New Issue
Block a user