fix: not render all styles when css extracted

This commit is contained in:
Clark Du 2018-03-21 20:45:58 +08:00
parent 4b8545710c
commit df939be712
No known key found for this signature in database
GPG Key ID: D0E5986AF78B86D9
2 changed files with 14 additions and 10 deletions

View File

@ -67,15 +67,17 @@ export default ({isVueLoader = false, isServer}) => {
})
// -- With extractCSS --
if (!isServer && this.options.build.extractCSS) {
loaders.unshift(MiniCssExtractPlugin.loader)
if (this.options.dev) {
// css-hot-loader
// https://github.com/shepherdwind/css-hot-loader
loaders.unshift({
loader: 'css-hot-loader',
options: { sourceMap }
})
if (this.options.build.extractCSS) {
if (!isServer) {
loaders.unshift(MiniCssExtractPlugin.loader)
if (this.options.dev) {
// css-hot-loader
// https://github.com/shepherdwind/css-hot-loader
loaders.unshift({
loader: 'css-hot-loader',
options: { sourceMap }
})
}
}
} else {
// Prepare vue-style-loader

View File

@ -376,7 +376,9 @@ export default class Renderer {
APP += m.script.text({ body: true })
APP += m.noscript.text({ body: true })
HEAD += context.renderStyles()
if (!this.options.build.extractCSS) {
HEAD += context.renderStyles()
}
let html = this.resources.ssrTemplate({
HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(),