Skip to content

Commit

Permalink
Merge pull request #93 from subpopular/patch-4
Browse files Browse the repository at this point in the history
Handle module build errors in SCSS files
  • Loading branch information
erikras committed Aug 4, 2015
2 parents 15558c1 + 517e958 commit 2116e9b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions webpack/utils/writeStats.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,11 @@ module.exports = function writeStats(stats, env) {
}
}
//end
var regex = env === 'prod' ? /module\.exports = ((.|\n)+);/ : /exports\.locals = ((.|\n)+);/;
var match = m.source.match(regex);
cssModules[name] = match ? JSON.parse(match[1]) : {};
if (m.source) {
var regex = env === 'prod' ? /module\.exports = ((.|\n)+);/ : /exports\.locals = ((.|\n)+);/;
var match = m.source.match(regex);
cssModules[name] = match ? JSON.parse(match[1]) : {};
}
});

// Find compiled images in modules
Expand Down
6 changes: 5 additions & 1 deletion webpack/webpack-dev-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ var WebpackDevServer = require('webpack-dev-server'),
headers: {"Access-Control-Allow-Origin": "*"},
stats: {colors: true}
},
compiler = webpack(config),
compiler = webpack(config, function(err, stats){
var json = stats.toJson();
if (json.errors.length)
console.error(json.errors[0])
}),
webpackDevServer = new WebpackDevServer(compiler, serverOptions);

webpackDevServer.listen(port, host, function() {
Expand Down

0 comments on commit 2116e9b

Please sign in to comment.