Remove duplicated stack from thread-loader (#3847)

This commit is contained in:
Joe Haddad
2018-01-17 22:05:35 -05:00
committed by GitHub
parent ee2dd27ec1
commit f0719866f2

View File

@@ -40,6 +40,21 @@ function formatMessage(message, isError) {
lines[0] = lines[0].substr(lines[0].lastIndexOf('!') + 1);
}
// Remove unnecessary stack added by `thread-loader`
var threadLoaderIndex = -1;
lines.forEach(function(line, index) {
if (threadLoaderIndex !== -1) {
return;
}
if (line.indexOf('from thread-loader (worker') !== -1) {
threadLoaderIndex = index;
}
});
if (threadLoaderIndex !== -1) {
lines = lines.slice(0, threadLoaderIndex);
}
lines = lines.filter(function(line) {
// Webpack adds a list of entry points to warning messages:
// @ ./src/index.js