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,7 +67,8 @@ export default ({isVueLoader = false, isServer}) => {
})
// -- With extractCSS --
if (!isServer && this.options.build.extractCSS) {
if (this.options.build.extractCSS) {
if (!isServer) {
loaders.unshift(MiniCssExtractPlugin.loader)
if (this.options.dev) {
// css-hot-loader
@ -77,6 +78,7 @@ export default ({isVueLoader = false, isServer}) => {
options: { sourceMap }
})
}
}
} else {
// Prepare vue-style-loader
// https://github.com/vuejs/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 })
if (!this.options.build.extractCSS) {
HEAD += context.renderStyles()
}
let html = this.resources.ssrTemplate({
HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(),