mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
fix: css extraction with MiniCssExtractPlugin
This commit is contained in:
parent
17dbd2e947
commit
62cd611c19
@ -227,7 +227,10 @@ export default class WebpackBaseConfig {
|
||||
}
|
||||
|
||||
// CSS extraction
|
||||
if (this.options.build.extractCSS) {
|
||||
// MiniCssExtractPlugin does not currently supports SSR
|
||||
// https://github.com/webpack-contrib/mini-css-extract-plugin/issues/48
|
||||
// So we use css-loader/locals as a fallback (utils/style-loader)
|
||||
if (this.options.build.extractCSS && !this.isServer) {
|
||||
plugins.push(new MiniCssExtractPlugin(Object.assign({
|
||||
filename: this.getFileName('css')
|
||||
}, this.options.build.extractCSS)))
|
||||
|
@ -70,7 +70,7 @@ export default class StyleLoader {
|
||||
}
|
||||
|
||||
return {
|
||||
loader: 'css-loader',
|
||||
loader: (this.isServer && this.extractCSS) ? 'css-loader/locals' : 'css-loader',
|
||||
options: {
|
||||
sourceMap: this.sourceMap,
|
||||
minimize: !this.dev,
|
||||
@ -81,7 +81,7 @@ export default class StyleLoader {
|
||||
}
|
||||
|
||||
extract() {
|
||||
if (this.extractCSS) {
|
||||
if (this.extractCSS && !this.isServer) {
|
||||
return MiniCssExtractPlugin.loader
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user