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.

Non-descriptive error message if webpack.config.js is invalid

See original GitHub issue

Take the Spring Boot starter project and replace webpack.config.js with

foo

If you run node_modules/.bin/webpack manually, you will get

ReferenceError: foo is not defined
    at Object.<anonymous> (.../webpack.config.js:1:63)

If you run mvn, you get

2020-02-03 12:15:47.107 ERROR 60528 --- [  restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/]       : Exception sending context initialized event to listener instance of class [com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener]

java.lang.RuntimeException: Unable to initialize Vaadin DevModeHandler
	at com.vaadin.flow.spring.VaadinServletContextInitializer$DevModeServletContextListener.contextInitialized(VaadinServletContextInitializer.java:349) ~[vaadin-spring-12.2.0.alpha1.jar:na]
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4680) [tomcat-embed-core-9.0.22.jar:9.0.22]
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5143) [tomcat-embed-core-9.0.22.jar:9.0.22]
...
Caused by: java.lang.IllegalStateException: Webpack exited prematurely
	at com.vaadin.flow.server.DevModeHandler.<init>(DevModeHandler.java:201) ~[flow-server-2.2.0.alpha10.jar:2.2.0.alpha10]
	at com.vaadin.flow.server.DevModeHandler.createInstance(DevModeHandler.java:298) ~[flow-server-2.2.0.alpha10.jar:2.2.0.alpha10]
	at com.vaadin.flow.server.DevModeHandler.start(DevModeHandler.java:248) ~[flow-server-2.2.0.alpha10.jar:2.2.0.alpha10]

This does not even contain a reference to webpack.config.js nor to the problem that actually occured in webpack

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
mvysnycommented, Apr 8, 2021

Same thing here with Vaadin 14.5.1: I only see the exception but there is no indication in the entire stdout as to why the webpack would fail:

Caused by: java.lang.IllegalStateException: Webpack exited prematurely
        at com.vaadin.flow.server.DevModeHandler.doStartWebpack(DevModeHandler.java:657)
        at com.vaadin.flow.server.DevModeHandler.doStartDevModeServer(DevModeHandler.java:583)
        at com.vaadin.flow.server.DevModeHandler.runOnFutureComplete(DevModeHandler.java:530)
        at com.vaadin.flow.server.DevModeHandler.lambda$new$0(DevModeHandler.java:146)
        at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:774)

This started to happen after I applied the checker from #8475 . Without the checker the Vaadin would fail in runtime with Uncaught DOMException: CustomElementRegistry.define: 'vaadin-lumo-styles' has already been defined as a custom element: the checker apparently catches the issue early on (which is a good thing), but then Vaadin logs nothing of the issue and fails with this useless exception.

This is a horrible dev UX experience - my project doesn’t start anymore, and I have no idea why. I would rather revert the checker and go back to failing at runtime, at least there I’ll receive an “informative” error message.

0reactions
vaadin-botcommented, Apr 19, 2021

This ticket/PR has been released with platform 14.5.3. For prerelease versions, it will be included in its final version.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Invalid configuration object in webpack.config.js - Stack Overflow
I tried it and it didn't work. I should try all my code again. maybe there is a mistake somewhere else, because I...
Read more >
How I solved and debugged my Webpack issue through trial ...
My debugging journey started with the following setup: webpack.config.js // webpack v4.6.0 const path = require('path');const ...
Read more >
file-loader - webpack - JS.ORG
Since file-loader is applied when compiling the application, and not when running it, the environment variable cannot be used in the file-loader configuration....
Read more >
CopyWebpackPlugin | webpack
Enables transform caching and setup cache directory and invalidation keys. webpack.config.js module.exports = { plugins: [ new ...
Read more >
Externals - webpack
<script src="https://code.jquery.com/jquery-3.1.0.js" ... under externals in the above webpack.config.js indicates that the module jquery in import $ from ...
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