question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Webpack errors are not logged

See original GitHub issue

I’m submitting a feature request

Webpack version: 2.x

Webpack Karma version: 2.0.x

Karma version: 1.x

Please tell us about your environment: OSX 10.x

Current behavior: karma-webpack do not log webpack configuration issues. Simply reports

26 02 2017 22:08:57.640:ERROR [preprocess]: Can not load "webpack"!
  Error
    at webpack (..../node_modules/webpack/lib/webpack.js:19:9)

code here https://github.com/webpack-contrib/karma-webpack/blob/v2/src/karma-webpack.js#L65

Expected/desired behavior: Instead karma-webpack should catch expcetion thrown by webpack and log message on exception.

Replacing above line with

  var compiler;
  try {
    compiler = webpack(webpackOptions);
  } catch(e) {
    console.error(e.message);
    throw e;
  }

Report is

Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema.
 - configuration.module has an unknown property 'preLoaders'. These properties are valid:
   object { exprContextCritical?, exprContextRecursive?, exprContextRegExp?, exprContextRequest?, loaders?, noParse?, rules?, unknownContextCritical?, unknownContextRecursive?, unknownContextRegExp?, unknownContextRequest?, unsafeCache?, wrappedContextCritical?, wrappedContextRecursive?, wrappedContextRegExp? }
   Options affecting the normal modules (`NormalModuleFactory`).
 - configuration.resolve.extensions[0] should not be empty.
26 02 2017 22:08:57.640:ERROR [preprocess]: Can not load "webpack"!
  Error
    at webpack (..../webpack/lib/webpack.js:19:9)
  • What is the motivation / use case for changing the behavior? Make easier to resolve webpack configuration issues.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
joshwienscommented, Mar 10, 2017

@marcusellis05 - It’s next on my list after css-loader to go out. Couple of hours to npm

1reaction
patopecommented, Feb 27, 2017

@d3viant0ne yes, i know. But, that is not point of this report. Could you reread this?

karma-webpack currently keeps this information hidden from user and reports only Can not load "webpack"!. Which is not very informative and generates unneccessary support requests for you.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Webpack errors are not logged · Issue #227 - GitHub
Invalid configuration object. Webpack has been initialised using a configuration object that does not match the API schema. - configuration.
Read more >
Angular 2 & Webpack: Most errors not logged to the console
I've noticed that errors thrown by angular are not being logged to the console since I switched to Webpack. Does anybody know how...
Read more >
How I solved and debugged my Webpack issue through trial ...
When webpack bundles your source code, it can become difficult to track down errors and warnings to their original location.
Read more >
KJS / Gradle: webpack plugin errors not logged : KT-50442
Error occurred. See log for details. * Try: Run with --info or --debug option to get more log output. Run with --scan to...
Read more >
Other Options - webpack
By default webpack will log these errors in red in the terminal, ... Remember that current configuration will not compile until its dependencies...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found