@@ -163,6 +163,7 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
163163 // Style
164164 let css = '' ;
165165 let cssHash = '' ;
166+ let cssModulesHash = '' ;
166167 if ( compileResult . styles . length !== 0 ) {
167168 for ( let style of compileResult . styles ) {
168169 css += style . css ;
@@ -171,6 +172,10 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
171172 cssHash = Hash ( css ) ;
172173
173174 //console.log(`css hash: ${cssHash}`);
175+
176+ if ( compileResult . cssModules ) {
177+ cssModulesHash = Hash ( JSON . stringify ( compileResult . cssModules ) ) ;
178+ }
174179
175180 if ( isDev ) {
176181 // Add style to client first-connection style list
@@ -188,6 +193,7 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
188193 cache . filePath = getFilePath ( inputFile ) ;
189194 cache . js = jsHash ;
190195 cache . css = cssHash ;
196+ cache . cssModules = cssModulesHash ;
191197 cache . template = templateHash ;
192198 }
193199 }
@@ -323,7 +329,7 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
323329 let vueId = compileResult . hash ;
324330
325331 // CSS
326- let css = '' , cssHash = '' ;
332+ let css = '' , cssHash = '' , cssModulesHash = '' ;
327333 if ( parts . style ) {
328334 if ( compileResult . styles . length !== 0 ) {
329335 for ( let style of compileResult . styles ) {
@@ -335,6 +341,11 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
335341 if ( cache . css !== cssHash ) {
336342 global . _dev_server . __addStyle ( { hash : vueId , css, path : inputFilePath } ) ;
337343 }
344+
345+ if ( compileResult . cssModules ) {
346+ cssModulesHash = Hash ( JSON . stringify ( compileResult . cssModules ) ) ;
347+ console . log ( 'css modules hash' , cssModulesHash )
348+ }
338349 }
339350 }
340351
@@ -354,13 +365,13 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
354365 }
355366 }
356367
357- if ( cache . js !== jsHash || cache . template !== templateHash ) {
368+ if ( cache . js !== jsHash || cache . template !== templateHash || cache . cssModules !== cssModulesHash ) {
358369
359370 const path = ( inputFile . getPackageName ( ) ? `packages/${ inputFile . getPackageName ( ) } ` : '' ) + inputFile . getPathInPackage ( ) ;
360371
361372 const { js, render, staticRenderFns } = generateJs ( vueId , inputFile , compileResult , true )
362373
363- if ( vueVersion === 2 && cache . js === jsHash ) {
374+ if ( vueVersion === 2 && cache . js === jsHash && cache . cssModules === cssModulesHash ) {
364375 global . _dev_server . emit ( 'render' , { hash : vueId , template :`{
365376 render: ${ render } ,
366377 staticRenderFns: ${ staticRenderFns }
@@ -377,6 +388,7 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
377388 }
378389 if ( parts . style ) {
379390 cache . css = cssHash ;
391+ cache . cssModules = cssModulesHash ;
380392 }
381393 if ( parts . template ) {
382394 cache . template = templateHash ;
0 commit comments