chore: minor webpack fixes

This commit is contained in:
Pooya Parsa 2018-03-22 20:52:41 +04:30
parent 765f560b8c
commit 4c5c7b3bb4
5 changed files with 13 additions and 8 deletions

View File

@ -18,8 +18,8 @@ import upath from 'upath'
import { r, wp, wChunk, createRoutes, parallel, relativeTo, waitFor, createSpinner } from '../common/utils' import { r, wp, wChunk, createRoutes, parallel, relativeTo, waitFor, createSpinner } from '../common/utils'
import Options from '../common/options' import Options from '../common/options'
import ClientWebpackConfig from './webpack/client.config' import ClientWebpackConfig from './webpack/client'
import ServerWebpackConfig from './webpack/server.config' import ServerWebpackConfig from './webpack/server'
const debug = Debug('nuxt:build') const debug = Debug('nuxt:build')
debug.color = 2 // Force green color debug.color = 2 // Force green color

View File

@ -168,8 +168,8 @@ export default class WebpackBaseConfig {
// Hide warnings about plugins without a default export (#1179) // Hide warnings about plugins without a default export (#1179)
plugins.push(new WarnFixPlugin()) plugins.push(new WarnFixPlugin())
if (!this.options.test) {
// Build progress indicator // Build progress indicator
if (!this.options.test) {
if (this.options.build.profile) { if (this.options.build.profile) {
plugins.push(new webpack.ProgressPlugin({ profile: true })) plugins.push(new webpack.ProgressPlugin({ profile: true }))
} else { } else {
@ -181,11 +181,15 @@ export default class WebpackBaseConfig {
})) }))
} }
} }
}
// Add stats plugin // Add stats plugin
if (!this.options.dev) {
plugins.push(new StatsPlugin(this.options.build.stats)) plugins.push(new StatsPlugin(this.options.build.stats))
}
// Add friendly error plugin // Add friendly error plugin
if (!this.options.dev && !this.options.test) {
plugins.push( plugins.push(
new FriendlyErrorsWebpackPlugin({ new FriendlyErrorsWebpackPlugin({
clearConsole: true, clearConsole: true,
@ -193,6 +197,7 @@ export default class WebpackBaseConfig {
}) })
) )
} }
return plugins return plugins
} }

View File

@ -6,7 +6,7 @@ import BundleAnalyzer from 'webpack-bundle-analyzer'
import MiniCssExtractPlugin from 'mini-css-extract-plugin' import MiniCssExtractPlugin from 'mini-css-extract-plugin'
import VueSSRClientPlugin from './plugins/vue/client' import VueSSRClientPlugin from './plugins/vue/client'
import BaseConfig from './base.config' import BaseConfig from './base'
export default class WebpackClientConfig extends BaseConfig { export default class WebpackClientConfig extends BaseConfig {
constructor(builder) { constructor(builder) {

View File

@ -4,7 +4,7 @@ import fs from 'fs'
import webpack from 'webpack' import webpack from 'webpack'
import nodeExternals from 'webpack-node-externals' import nodeExternals from 'webpack-node-externals'
import BaseConfig from './base.config' import BaseConfig from './base'
import VueSSRServerPlugin from './plugins/vue/server' import VueSSRServerPlugin from './plugins/vue/server'
export default class WebpackServerConfig extends BaseConfig { export default class WebpackServerConfig extends BaseConfig {

View File

@ -4,7 +4,7 @@ import path from 'path'
import ـ from 'lodash' import ـ from 'lodash'
import createResolver from 'postcss-import-resolver' import createResolver from 'postcss-import-resolver'
import { isPureObject } from '../../common/utils' import { isPureObject } from '../../../common/utils'
export default function postcssConfig() { export default function postcssConfig() {
let config = ـ.cloneDeep(this.options.build.postcss) let config = ـ.cloneDeep(this.options.build.postcss)