Skip to content

Commit

Permalink
fix(css-modules): support namedExport: false
Browse files Browse the repository at this point in the history
  • Loading branch information
Airkro committed Jul 22, 2021
1 parent 91c162b commit ac3849e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/codegen/styleInjection.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,14 @@ module.exports = function genStyleInjectionCode (

// `(vue-)style-loader` exports the name-to-hash map directly
// `css-loader` exports it in `.locals`
const locals = `style${i}`
const locals = `styleTemp${i}.default || styleTemp${i}.locals || styleTemp${i}`
const name = JSON.stringify(moduleName)

if (!needsHotReload) {
styleInjectionCode += `this[${name}] = ${locals}\n`
} else {
styleInjectionCode += `
const styleTemp${i} = style${i};
cssModules[${name}] = ${locals}
Object.defineProperty(this, ${name}, {
configurable: true,
Expand Down

0 comments on commit ac3849e

Please sign in to comment.