diff --git a/src/transformers/moduleNotFound.js b/src/transformers/moduleNotFound.js index 2e5e0c4..be0e6eb 100644 --- a/src/transformers/moduleNotFound.js +++ b/src/transformers/moduleNotFound.js @@ -19,7 +19,7 @@ function transform(error) { message: `Module not found ${module}`, type: TYPE, severity: 900, - module, + module: module || extractModuleName(webpackError.message || ''), name: 'Module not found' }); } @@ -27,4 +27,14 @@ function transform(error) { return error; } +const re = /Can't resolve '([^']*)'/ + +function extractModuleName(message) { + const matches = message.match(re) + + if (matches && matches[1]) { + return matches[1] + } +} + module.exports = transform;