From 0a7ecd26dd34ffd1a37682392f3a48f2a7165b83 Mon Sep 17 00:00:00 2001 From: Pooya Parsa Date: Fri, 23 Mar 2018 20:58:35 +0430 Subject: [PATCH] fix(builder): fix extractCSS problem --- lib/builder/webpack/base.mjs | 8 ++++++++ lib/builder/webpack/client.mjs | 9 --------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/lib/builder/webpack/base.mjs b/lib/builder/webpack/base.mjs index 58d02de195..606dccd381 100644 --- a/lib/builder/webpack/base.mjs +++ b/lib/builder/webpack/base.mjs @@ -4,6 +4,7 @@ import TimeFixPlugin from 'time-fix-plugin' import webpack from 'webpack' import _ from 'lodash' import VueLoader from 'vue-loader' +import MiniCssExtractPlugin from 'mini-css-extract-plugin' import { isUrl, urlJoin } from '../../common/utils' @@ -214,6 +215,13 @@ export default class WebpackBaseConfig { plugins.push(new StatsPlugin(this.options.build.stats)) } + // CSS extraction + if (this.options.build.extractCSSS) { + plugins.push(new MiniCssExtractPlugin(Object.assign({ + filename: this.getFileName('css') + }, this.options.build.extractCSS))) + } + return plugins } diff --git a/lib/builder/webpack/client.mjs b/lib/builder/webpack/client.mjs index d98dc836ee..9efcc45f52 100644 --- a/lib/builder/webpack/client.mjs +++ b/lib/builder/webpack/client.mjs @@ -3,7 +3,6 @@ import path from 'path' import webpack from 'webpack' import HTMLPlugin from 'html-webpack-plugin' import BundleAnalyzer from 'webpack-bundle-analyzer' -import MiniCssExtractPlugin from 'mini-css-extract-plugin' import UglifyJsWebpackPlugin from 'uglifyjs-webpack-plugin' import FriendlyErrorsWebpackPlugin from '@nuxtjs/friendly-errors-webpack-plugin' @@ -73,14 +72,6 @@ export default class WebpackClientConfig extends WebpackBaseConfig { ) } - // CSS extraction - const extractCSS = this.options.build.extractCSS - if (extractCSS) { - plugins.push(new MiniCssExtractPlugin(Object.assign({ - filename: this.getFileName('css') - }, typeof extractCSS === 'object' ? extractCSS : {}))) - } - return plugins }