mirror of
https://github.com/nuxt/nuxt.git
synced 2025-02-17 06:01:34 +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 TimeFixPlugin = require('time-fix-plugin')
|
||||||
const WarnFixPlugin = require('./plugins/warnfix')
|
const WarnFixPlugin = require('./plugins/warnfix')
|
||||||
const ProgressPlugin = require('./plugins/progress')
|
const ProgressPlugin = require('./plugins/progress')
|
||||||
|
const FriendlyErrorsWebpackPlugin = require('@nuxtjs/friendly-errors-webpack-plugin')
|
||||||
|
|
||||||
const webpack = require('webpack')
|
const webpack = require('webpack')
|
||||||
const { cloneDeep } = require('lodash')
|
const { cloneDeep } = require('lodash')
|
||||||
@ -144,6 +145,15 @@ module.exports = function webpackBaseConfig({ name, isServer }) {
|
|||||||
// Hide warnings about plugins without a default export (#1179)
|
// Hide warnings about plugins without a default export (#1179)
|
||||||
config.plugins.push(new WarnFixPlugin())
|
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
|
// Clone deep avoid leaking config between Client and Server
|
||||||
return cloneDeep(config)
|
return cloneDeep(config)
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@ const webpack = require('webpack')
|
|||||||
// const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
|
// const VueSSRClientPlugin = require('vue-server-renderer/client-plugin')
|
||||||
const VueSSRClientPlugin = require('./plugins/vue/client')
|
const VueSSRClientPlugin = require('./plugins/vue/client')
|
||||||
const HTMLPlugin = require('html-webpack-plugin')
|
const HTMLPlugin = require('html-webpack-plugin')
|
||||||
const FriendlyErrorsWebpackPlugin = require('@nuxtjs/friendly-errors-webpack-plugin')
|
|
||||||
const StylishPlugin = require('webpack-stylish')
|
const StylishPlugin = require('webpack-stylish')
|
||||||
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer')
|
||||||
const { resolve } = require('path')
|
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
|
// Optimization
|
||||||
config.optimization.splitChunks = {
|
config.optimization.splitChunks = {
|
||||||
chunks: 'all',
|
chunks: 'all',
|
||||||
|
Loading…
Reference in New Issue
Block a user