Skip to content

Commit

Permalink
fix(webpack): print file name and location in webpack warnings
Browse files Browse the repository at this point in the history
Example:
```
hops-demo:warning Should not import the named export 'config' (imported as 'config') from default-exporting module (only default export is available soon) (../../../../node_modules/something/main.js:8:4-10)
hops-demo:warning Critical dependency: the request of a dependency is an expression (./src/main.js:36:0-12)
```
  • Loading branch information
ZauberNerd committed Jan 12, 2022
1 parent 25cbffc commit 0e4a05c
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion packages/webpack/lib/plugins/log.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,12 @@ exports.LoggerPlugin = class LoggerPlugin {
return acc;
}, [])
.forEach((error) => this.logger.error(error));

warnings
.concat(...children.map((c) => c.warnings))
.forEach(({ message: warning }) => this.logger.warn(warning));
.forEach(({ message: warning, moduleName, loc }) => {
this.logger.warn(warning, chalk.gray(`(${moduleName}:${loc})`));
});
}

this.lastHashes[name] = hash;
Expand Down

0 comments on commit 0e4a05c

Please sign in to comment.