Skip to content

Commit cfcfc74

Browse files
kazuponyyx990803
authored andcommitted
fix cannot apply css modules to vue instance (vuejs#609)
1 parent 733c810 commit cfcfc74

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

lib/loader.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -338,8 +338,15 @@ module.exports = function (content) {
338338
' hotAPI.createRecord("' + moduleId + '", Component.options)\n' +
339339
' } else {\n' +
340340
// update
341+
' if (module.hot.data.cssModules && JSON.stringify(module.hot.data.cssModules) !== JSON.stringify(cssModules)) {\n' +
342+
' delete Component.options._Ctor\n' +
343+
' }\n' +
341344
' hotAPI.reload("' + moduleId + '", Component.options)\n' +
342345
' }\n' +
346+
// save cssModules
347+
' module.hot.dispose(function (data) {\n' +
348+
' data.cssModules = cssModules\n' +
349+
' })\n' +
343350
'})()}\n'
344351
}
345352
// final export

0 commit comments

Comments
 (0)