diff --git a/lib/builder/webpack/style-loader.js b/lib/builder/webpack/style-loader.js index 023acc06d5..86b6cf52dd 100644 --- a/lib/builder/webpack/style-loader.js +++ b/lib/builder/webpack/style-loader.js @@ -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 diff --git a/lib/core/renderer.mjs b/lib/core/renderer.mjs index 0bf1063201..a3c9b2f27a 100644 --- a/lib/core/renderer.mjs +++ b/lib/core/renderer.mjs @@ -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(),