Home > OS >  Added Vaadin to Java Spring project in IntelliJ and getting runtime error import.meta
Added Vaadin to Java Spring project in IntelliJ and getting runtime error import.meta

Time:09-26

I have created a new project with Spring Initializr:

  • Project: Gradle Project
  • Language: Java
  • Spring Boot: 2.7.4
  • Packaging: JAR
  • Java: 8
  • Dependencies: Spring Boot Actuator, Spring Data JPA, Spring Web, H2 Database, PostgresSQL Driver, Spring Configuration Processor

When I run the application I see the following:

  • Output from IntelliJ IDE indicates to go to enter image description here
  • Next, open Chrome Browser and navigate to the URL: Web page 1 of 2
  • Wait a second or two and the web page displays and just sits there: Web page 1 of 3
  • After waiting for a while, look back at the output from the IDE: enter image description here

Getting the error:

2022-09-23 11:25:25.969  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : [vite] warning: "import.meta" is not available in the configured target environment ("es2019") and will be empty
2022-09-23 11:25:25.969  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 1  |  // @ts-ignore
2022-09-23 11:25:25.969  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 2  |  if (import.meta.hot) {
2022-09-23 11:25:25.969  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :    |      ^
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 3  |    // @ts-ignore
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 4  |    const hot = import.meta.hot;
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   Plugin: vite:esbuild
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   File: C:/Users/krzysztof/Downloads/fundemo_v2/fundemo/frontend/generated/vite-devmode.ts
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : [vite] warning: "import.meta" is not available in the configured target environment ("es2019") and will be empty
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 2  |  if (import.meta.hot) {
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 3  |    // @ts-ignore
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 4  |    const hot = import.meta.hot;
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :    |                ^
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 5  |  
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 6  |    const isLiveReloadDisabled = () => {
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   : 
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   Plugin: vite:esbuild
2022-09-23 11:25:25.970  INFO 2916 --- [v-server-output] c.v.b.devserver.DevServerOutputTracker   :   File: C:/Users/krzysztof/Downloads/fundemo_v2/fundemo/frontend/generated/vite-devmode.ts

How could I get around this error?

CodePudding user response:

The correct URL is http://localhost:8080

The other is an internal debug url

CodePudding user response:

In addition to using the wrong http port instead of the default 8080: you're not indicating your Vaadin version, but if you're using the latest major (23.x or newer), you'll need to upgrade to Java 11 or newer.

  • Related