@@ -163,6 +163,7 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
163
163
// Style
164
164
let css = '' ;
165
165
let cssHash = '' ;
166
+ let cssModulesHash = '' ;
166
167
if ( compileResult . styles . length !== 0 ) {
167
168
for ( let style of compileResult . styles ) {
168
169
css += style . css ;
@@ -171,6 +172,10 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
171
172
cssHash = Hash ( css ) ;
172
173
173
174
//console.log(`css hash: ${cssHash}`);
175
+
176
+ if ( compileResult . cssModules ) {
177
+ cssModulesHash = Hash ( JSON . stringify ( compileResult . cssModules ) ) ;
178
+ }
174
179
175
180
if ( isDev ) {
176
181
// Add style to client first-connection style list
@@ -188,6 +193,7 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
188
193
cache . filePath = getFilePath ( inputFile ) ;
189
194
cache . js = jsHash ;
190
195
cache . css = cssHash ;
196
+ cache . cssModules = cssModulesHash ;
191
197
cache . template = templateHash ;
192
198
}
193
199
}
@@ -323,7 +329,7 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
323
329
let vueId = compileResult . hash ;
324
330
325
331
// CSS
326
- let css = '' , cssHash = '' ;
332
+ let css = '' , cssHash = '' , cssModulesHash = '' ;
327
333
if ( parts . style ) {
328
334
if ( compileResult . styles . length !== 0 ) {
329
335
for ( let style of compileResult . styles ) {
@@ -335,6 +341,11 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
335
341
if ( cache . css !== cssHash ) {
336
342
global . _dev_server . __addStyle ( { hash : vueId , css, path : inputFilePath } ) ;
337
343
}
344
+
345
+ if ( compileResult . cssModules ) {
346
+ cssModulesHash = Hash ( JSON . stringify ( compileResult . cssModules ) ) ;
347
+ console . log ( 'css modules hash' , cssModulesHash )
348
+ }
338
349
}
339
350
}
340
351
@@ -354,13 +365,13 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
354
365
}
355
366
}
356
367
357
- if ( cache . js !== jsHash || cache . template !== templateHash ) {
368
+ if ( cache . js !== jsHash || cache . template !== templateHash || cache . cssModules !== cssModulesHash ) {
358
369
359
370
const path = ( inputFile . getPackageName ( ) ? `packages/${ inputFile . getPackageName ( ) } ` : '' ) + inputFile . getPathInPackage ( ) ;
360
371
361
372
const { js, render, staticRenderFns } = generateJs ( vueId , inputFile , compileResult , true )
362
373
363
- if ( vueVersion === 2 && cache . js === jsHash ) {
374
+ if ( vueVersion === 2 && cache . js === jsHash && cache . cssModules === cssModulesHash ) {
364
375
global . _dev_server . emit ( 'render' , { hash : vueId , template :`{
365
376
render: ${ render } ,
366
377
staticRenderFns: ${ staticRenderFns }
@@ -377,6 +388,7 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
377
388
}
378
389
if ( parts . style ) {
379
390
cache . css = cssHash ;
391
+ cache . cssModules = cssModulesHash ;
380
392
}
381
393
if ( parts . template ) {
382
394
cache . template = templateHash ;
0 commit comments