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
928a230f91
commit
de6ca3a4f9
@ -291,10 +291,6 @@ export function getNuxtConfig(_options) {
|
||||
options.build.optimization.minimize = !options.dev
|
||||
}
|
||||
|
||||
if (options.dev) {
|
||||
options.build.extractCSS = false
|
||||
}
|
||||
|
||||
// Enable optimizeCSS only when extractCSS is enabled
|
||||
if (options.build.optimizeCSS === undefined) {
|
||||
options.build.optimizeCSS = options.build.extractCSS ? {} : false
|
||||
|
@ -327,15 +327,27 @@ export default class WebpackBaseConfig {
|
||||
}
|
||||
|
||||
plugins() {
|
||||
const plugins = [new VueLoader.VueLoaderPlugin()]
|
||||
|
||||
Array.prototype.push.apply(plugins, this.options.build.plugins || [])
|
||||
const plugins = []
|
||||
|
||||
// Add timefix-plugin before others plugins
|
||||
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)
|
||||
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) {
|
||||
plugins.push(new HardSourcePlugin(Object.assign({}, this.options.build.hardSource)))
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user