Skip to content

Commit

Permalink
Fix import-js#536: For Resolve error report err.stack
Browse files Browse the repository at this point in the history
Resolve errors are most likely caused by invalid configuration, and the reason is easier to determine with the full details rather than just `err.message`.

See import-js#536

With this change, it reports something like:
```
import/no-unresolved: Resolve error: SyntaxError: Unexpected token import
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:387:25)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at module.exports (/__censored__/webpack/configFactory.js:216:3)
    at configProdClient (/__censored__/webpack/configProdClient.js:5:36)
    at Object.<anonymous> (/__censored__/webpack/configForEslintImportResolver.js:1:126)
```
  • Loading branch information
sompylasar authored Oct 2, 2016
1 parent 0e6cbac commit b4f7e7e
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion utils/resolve.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ function resolve(p, context) {
} catch (err) {
if (!erroredContexts.has(context)) {
context.report({
message: `Resolve error: ${err.message}`,
message: `Resolve error: ${err.stack || err.message}`,
loc: { line: 1, column: 0 },
})
erroredContexts.add(context)
Expand Down

0 comments on commit b4f7e7e

Please sign in to comment.