mirror of
https://github.com/nuxt/nuxt.git
synced 2025-03-03 19:24:35 +00:00
Merge branch 'dev' into feat/jest
This commit is contained in:
commit
2976c575ab
@ -1,6 +1,6 @@
|
||||
import path from 'path'
|
||||
|
||||
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
||||
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
|
||||
import TimeFixPlugin from 'time-fix-plugin'
|
||||
import webpack from 'webpack'
|
||||
import _ from 'lodash'
|
||||
@ -147,19 +147,14 @@ export default function webpackBaseConfig({ name, isServer }) {
|
||||
// Hide warnings about plugins without a default export (#1179)
|
||||
config.plugins.push(new WarnFixPlugin())
|
||||
|
||||
// CSS extraction
|
||||
const extractCSS = this.options.build.extractCSS
|
||||
if (extractCSS) {
|
||||
config.plugins.push(new ExtractTextPlugin(Object.assign({
|
||||
filename: this.getFileName('css')
|
||||
const shouldClearConsole =
|
||||
this.options.build.stats !== false &&
|
||||
this.options.build.stats !== 'errors-only'
|
||||
|
||||
// When using optimization.splitChunks and there are
|
||||
// extracted chunks in the commons chunk,
|
||||
// allChunks *must* be set to true
|
||||
// TODO: For nuxt this makes duplicate css assets!
|
||||
// allChunks: true
|
||||
}, typeof extractCSS === 'object' ? extractCSS : {})))
|
||||
}
|
||||
// Add friendly error plugin
|
||||
config.plugins.push(
|
||||
new FriendlyErrorsWebpackPlugin({ clearConsole: shouldClearConsole })
|
||||
)
|
||||
|
||||
// Clone deep avoid leaking config between Client and Server
|
||||
return _.cloneDeep(config)
|
||||
|
@ -2,8 +2,9 @@ import path from 'path'
|
||||
|
||||
import _ from 'lodash'
|
||||
import webpack from 'webpack'
|
||||
|
||||
import ExtractTextPlugin from 'extract-text-webpack-plugin'
|
||||
import HTMLPlugin from 'html-webpack-plugin'
|
||||
import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin'
|
||||
import StylishPlugin from 'webpack-stylish'
|
||||
import BundleAnalyzer from 'webpack-bundle-analyzer'
|
||||
|
||||
@ -78,17 +79,6 @@ export default function webpackClientConfig() {
|
||||
)
|
||||
)
|
||||
|
||||
const shouldClearConsole =
|
||||
this.options.build.stats !== false &&
|
||||
this.options.build.stats !== 'errors-only'
|
||||
|
||||
// Add friendly error plugin
|
||||
if (!this.options.test) {
|
||||
config.plugins.push(
|
||||
new FriendlyErrorsWebpackPlugin({ clearConsole: shouldClearConsole })
|
||||
)
|
||||
}
|
||||
|
||||
// Optimization
|
||||
config.optimization.splitChunks = {
|
||||
chunks: 'all',
|
||||
@ -130,7 +120,21 @@ export default function webpackClientConfig() {
|
||||
}
|
||||
|
||||
// Create additional runtime chunk for cache boosting
|
||||
// config.optimization.runtimeChunk = true
|
||||
config.optimization.runtimeChunk = true
|
||||
|
||||
// CSS extraction
|
||||
const extractCSS = this.options.build.extractCSS
|
||||
if (extractCSS) {
|
||||
config.plugins.push(new ExtractTextPlugin(Object.assign({
|
||||
filename: this.getFileName('css')
|
||||
|
||||
// When using optimization.splitChunks and there are
|
||||
// extracted chunks in the commons chunk,
|
||||
// allChunks *must* be set to true
|
||||
// TODO: For nuxt this makes duplicate css assets!
|
||||
// allChunks: true
|
||||
}, typeof extractCSS === 'object' ? extractCSS : {})))
|
||||
}
|
||||
|
||||
// --------------------------------------
|
||||
// Dev specific config
|
||||
|
Loading…
Reference in New Issue
Block a user