mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
fix(builder): fix extractCSS problem
This commit is contained in:
parent
f8aa4cd7d7
commit
0a7ecd26dd
@ -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
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user