You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a bit strange setup with gulp and browserify but I would still expect the following to work:
// build whole appgulp.task('build',['build-screen','build-remote']);// calls browserify to compile jsx files for the screengulp.task('build-screen',function(){bundle('screen');});// calls browserify to compile jsx files for the remotegulp.task('build-remote',function(){bundle('remote');});functionbundle(entry){returnbrowserify({entries: entry,extensions: ['.jsx'],basedir: './src',}).plugin(modulesify,{rootDir: './src',output: './static/css/'+entry+'.css',}).transform(babelify.configure({presets: ["es2015","react","stage-0"]})).bundle().pipe(source(entry)).pipe(rename({extname: '.js'})).pipe(gulp.dest('./static/js'));}
Instead of doing the expected (outputting 'screen.css' and 'remote.css' with their respective contents) it dumps all the css (for both instances) in 'remote.css' and produces an empty 'screen.css'.
If there are multiple loadersByFile the current loader will be the one that is called last, therefore Cmify will use the last added loader, this can be fixed relatively easily by adding the sourcekey to the Cmify opts and adding: var loader = loadersByFile[this.opts.sourcekey] to inside the flush method.
Activity
tjallingt commentedon Jan 15, 2016
Found the source of the issue:
https://github.com/css-modules/css-modulesify/blob/master/index.js#L145-L149
If there are multiple loadersByFile the current loader will be the one that is called last, therefore
Cmifywill use the last added loader, this can be fixed relatively easily by adding the sourcekey to theCmifyopts and adding:var loader = loadersByFile[this.opts.sourcekey]to inside the flush method.I will create a pull request shortly.