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 -- // -- With extractCSS --
if (!isServer && this.options.build.extractCSS) { if (this.options.build.extractCSS) {
loaders.unshift(MiniCssExtractPlugin.loader) if (!isServer) {
if (this.options.dev) { loaders.unshift(MiniCssExtractPlugin.loader)
// css-hot-loader if (this.options.dev) {
// https://github.com/shepherdwind/css-hot-loader // css-hot-loader
loaders.unshift({ // https://github.com/shepherdwind/css-hot-loader
loader: 'css-hot-loader', loaders.unshift({
options: { sourceMap } loader: 'css-hot-loader',
}) options: { sourceMap }
})
}
} }
} else { } else {
// Prepare vue-style-loader // Prepare vue-style-loader

View File

@ -376,7 +376,9 @@ export default class Renderer {
APP += m.script.text({ body: true }) APP += m.script.text({ body: true })
APP += m.noscript.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({ let html = this.resources.ssrTemplate({
HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(), HTML_ATTRS: 'data-n-head-ssr ' + m.htmlAttrs.text(),