Non-descriptive error message if webpack.config.js is invalid
See original GitHub issueTake 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:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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:
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.
This ticket/PR has been released with platform 14.5.3. For prerelease versions, it will be included in its final version.