@@ -161,15 +161,21 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
161
161
const lazyCSS = ! isDev && isLazy && inputFile . getArch ( ) . indexOf ( 'web' ) !== - 1
162
162
163
163
// Style
164
- let css = ''
165
- let cssHash = ''
164
+ let css = '' ;
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
169
170
}
170
171
171
172
cssHash = Hash ( css )
172
173
174
+ //console.log(`css hash: ${cssHash}`);
175
+
176
+ if ( compileResult . cssModules ) {
177
+ cssModulesHash = Hash ( JSON . stringify ( compileResult . cssModules ) ) ;
178
+ }
173
179
//console.log(`css hash: ${cssHash}`)
174
180
if ( lazyCSS ) {
175
181
// Wrap CSS in Meteor's lazy CSS loader
@@ -214,12 +220,13 @@ VueComponentCompiler = class VueCompo extends CachingCompiler {
214
220
}
215
221
216
222
if ( isDev ) {
217
- cache = Cache . getCache ( inputFile )
218
- cache . watcher . update ( inputFile )
219
- cache . filePath = getFilePath ( inputFile )
220
- cache . js = jsHash
221
- cache . css = cssHash
222
- cache . template = templateHash
223
+ cache = Cache . getCache ( inputFile ) ;
224
+ cache . watcher . update ( inputFile ) ;
225
+ cache . filePath = getFilePath ( inputFile ) ;
226
+ cache . js = jsHash ;
227
+ cache . css = cssHash ;
228
+ cache . cssModules = cssModulesHash ;
229
+ cache . template = templateHash ;
223
230
}
224
231
}
225
232
@@ -358,7 +365,7 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
358
365
let vueId = compileResult . hash
359
366
360
367
// CSS
361
- let css = '' , cssHash = ''
368
+ let css = '' , cssHash = '' , cssModulesHash = '' ;
362
369
if ( parts . style ) {
363
370
if ( compileResult . styles . length !== 0 ) {
364
371
for ( let style of compileResult . styles ) {
@@ -370,6 +377,10 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
370
377
if ( cache . css !== cssHash ) {
371
378
global . _dev_server . __addStyle ( { hash : vueId , css, path : inputFilePath } )
372
379
}
380
+
381
+ if ( compileResult . cssModules ) {
382
+ cssModulesHash = Hash ( JSON . stringify ( compileResult . cssModules ) ) ;
383
+ }
373
384
}
374
385
}
375
386
@@ -389,13 +400,13 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
389
400
}
390
401
}
391
402
392
- if ( cache . js !== jsHash || cache . template !== templateHash ) {
403
+ if ( cache . js !== jsHash || cache . template !== templateHash || cache . cssModules !== cssModulesHash ) {
393
404
394
405
const path = ( inputFile . getPackageName ( ) ? `packages/${ inputFile . getPackageName ( ) } ` : '' ) + inputFile . getPathInPackage ( )
395
406
396
407
const { js, render, staticRenderFns } = generateJs ( vueId , inputFile , compileResult , true )
397
408
398
- if ( vueVersion === 2 && cache . js === jsHash ) {
409
+ if ( vueVersion === 2 && cache . js === jsHash && cache . cssModules === cssModulesHash ) {
399
410
global . _dev_server . emit ( 'render' , { hash : vueId , template :`{
400
411
render: ${ render } ,
401
412
staticRenderFns: ${ staticRenderFns }
@@ -411,7 +422,8 @@ const hotCompile = Meteor.bindEnvironment(function hotCompile(filePath, inputFil
411
422
cache . js = jsHash
412
423
}
413
424
if ( parts . style ) {
414
- cache . css = cssHash
425
+ cache . css = cssHash ;
426
+ cache . cssModules = cssModulesHash ;
415
427
}
416
428
if ( parts . template ) {
417
429
cache . template = templateHash
0 commit comments