mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-11 08:33:53 +00:00
hotfix: extractCSS error in dev mode (#4892)
This commit is contained in:
parent
2b30915950
commit
a614fd3f81
@ -291,10 +291,6 @@ export function getNuxtConfig(_options) {
|
|||||||
options.build.optimization.minimize = !options.dev
|
options.build.optimization.minimize = !options.dev
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.dev) {
|
|
||||||
options.build.extractCSS = false
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enable optimizeCSS only when extractCSS is enabled
|
// Enable optimizeCSS only when extractCSS is enabled
|
||||||
if (options.build.optimizeCSS === undefined) {
|
if (options.build.optimizeCSS === undefined) {
|
||||||
options.build.optimizeCSS = options.build.extractCSS ? {} : false
|
options.build.optimizeCSS = options.build.extractCSS ? {} : false
|
||||||
|
@ -327,15 +327,27 @@ export default class WebpackBaseConfig {
|
|||||||
}
|
}
|
||||||
|
|
||||||
plugins() {
|
plugins() {
|
||||||
const plugins = [new VueLoader.VueLoaderPlugin()]
|
const plugins = []
|
||||||
|
|
||||||
Array.prototype.push.apply(plugins, this.options.build.plugins || [])
|
|
||||||
|
|
||||||
// Add timefix-plugin before others plugins
|
// Add timefix-plugin before others plugins
|
||||||
if (this.options.dev) {
|
if (this.options.dev) {
|
||||||
plugins.unshift(new TimeFixPlugin())
|
plugins.push(new TimeFixPlugin())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// CSS extraction)
|
||||||
|
if (this.options.build.extractCSS) {
|
||||||
|
plugins.push(new ExtractCssChunksPlugin(Object.assign({
|
||||||
|
filename: this.getFileName('css'),
|
||||||
|
chunkFilename: this.getFileName('css'),
|
||||||
|
// TODO: https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/issues/132
|
||||||
|
reloadAll: true
|
||||||
|
}, this.options.build.extractCSS)))
|
||||||
|
}
|
||||||
|
|
||||||
|
plugins.push(new VueLoader.VueLoaderPlugin())
|
||||||
|
|
||||||
|
Array.prototype.push.apply(plugins, this.options.build.plugins || [])
|
||||||
|
|
||||||
// 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())
|
||||||
|
|
||||||
@ -370,16 +382,6 @@ export default class WebpackBaseConfig {
|
|||||||
}
|
}
|
||||||
}))
|
}))
|
||||||
|
|
||||||
// CSS extraction)
|
|
||||||
if (this.options.build.extractCSS) {
|
|
||||||
plugins.push(new ExtractCssChunksPlugin(Object.assign({
|
|
||||||
filename: this.getFileName('css'),
|
|
||||||
chunkFilename: this.getFileName('css'),
|
|
||||||
// TODO: https://github.com/faceyspacey/extract-css-chunks-webpack-plugin/issues/132
|
|
||||||
reloadAll: true
|
|
||||||
}, this.options.build.extractCSS)))
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this.options.build.hardSource) {
|
if (this.options.build.hardSource) {
|
||||||
plugins.push(new HardSourcePlugin(Object.assign({}, this.options.build.hardSource)))
|
plugins.push(new HardSourcePlugin(Object.assign({}, this.options.build.hardSource)))
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user