Skip to content
This repository was archived by the owner on Aug 16, 2022. It is now read-only.

Commit 9a30f9e

Browse files
committed
fix: inject style for non-modules too
1 parent 0bee641 commit 9a30f9e

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/assemble.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ module.exports = function assemble (source, filename, config) {
3030
shortFilePath: filename,
3131
require: {
3232
vueHotReloadAPI: 'vue-hot-reload-api',
33-
normalizeComponent: 'vue-component-compiler/src/normalize-component.js'
33+
normalizeComponent: 'vue-component-compiler/src/runtime/normalize-component.js'
3434
},
3535
scopeId: null,
3636
moduleIdentifier: config.moduleIdentifier || hash(_s({ filename, config })), // require for server. TODO: verify this is correct.
@@ -61,14 +61,14 @@ module.exports = function assemble (source, filename, config) {
6161
const IMPORT_NAME = `__vue_style_${i}__`
6262
const IMPORT_STRING = _s(style.id)
6363
const moduleName = (style.descriptor.module === true) ? '$style' : style.descriptor.module
64-
const needsStyleInjection = config.isServer && config.hasStyleInjectFn
64+
const needsStyleInjection = config.hasStyleInjectFn
6565
const needsNamedImport = needsStyleInjection || typeof moduleName === 'string'
6666
const runInjection = needsStyleInjection ? `${IMPORT_NAME} && ${IMPORT_NAME}.__inject__ && ${IMPORT_NAME}.__inject__(ssrContext)\n` : ''
6767

6868
if (needsNamedImport) {
6969
output += config.esModule
7070
? `import ${IMPORT_NAME} from ${IMPORT_STRING}\n`
71-
: `const ${IMPORT_NAME} = requrie(${IMPORT_STRING})\n`
71+
: `const ${IMPORT_NAME} = require(${IMPORT_STRING})\n`
7272
} else {
7373
output += config.esModule
7474
? `import ${IMPORT_STRING}\n`
@@ -114,6 +114,7 @@ module.exports = function assemble (source, filename, config) {
114114
}
115115
}
116116
} else {
117+
styleInjectionCode += runInjection
117118
}
118119
})
119120
output += `function ${INJECT_STYLE_FN} (ssrContext) {\n` + pad(styleInjectionCode) + `}\n`

0 commit comments

Comments
 (0)