fix(builder): fix extractCSS problem

This commit is contained in:
Pooya Parsa 2018-03-23 20:58:35 +04:30
parent f8aa4cd7d7
commit 0a7ecd26dd
2 changed files with 8 additions and 9 deletions

View File

@ -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
}

View File

@ -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
}