Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PiT 24.4: when migrating a hilla project from 2.5.5 to 24.4.0.rc1 old stuff in generated folder fail compilation #19526

Open
Tracked by #5012
manolo opened this issue Jun 6, 2024 · 1 comment

Comments

@manolo
Copy link
Member

manolo commented Jun 6, 2024

Description of the bug

When migrating an existing hilla 2.5.5 application (generated in initializr) there are imports in generated ts that cannot be resolved because dependencies was not added to package.json

The error is:

Error: [vite]: Rollup failed to resolve import "@vaadin/hilla-frontend" from "src/main/frontend/generated/connect-client.default.ts".

Expected behavior

dependencies are added by flow

Minimal reproducible example

Unpack attached project and run ./mvnw spring-boot:run

initializer-hilla-maven.zip

The project was generated by downloading from https://start.spring.io and making changes in pom.xml as described below:

curl -s 'https://start.spring.io/starter.zip?type=maven-project&language=java&bootVersion=3.2.6&baseDir=initializer-hilla-maven&groupId=com.vaadin.initializer&artifactId=initializer-hilla-maven&name=initializer-hilla-maven&description=initializer-hilla-maven&packageName=com.vaadin.initializer&packaging=jar&javaVersion=17&dependencies=hilla,devtools' --output initializer-hilla-maven.zip
unzip -q initializer-hilla-maven.zip
cd initializer-hilla-maven
check that project works `./mvnw  spring-boot:run`

Migrate to 24.4.0.rc1 by applying the follow changes and re-run again

@@ -15,12 +15,14 @@
        <description>initializer-hilla-maven</description>
        <properties>
                <java.version>17</java.version>
-               <hilla.version>2.5.5</hilla.version>
+               <vaadin.version>24.4.0.rc1</vaadin.version>
        </properties>
+       <pluginRepositories><pluginRepository><id>v</id><url>https://maven.vaadin.com/vaadin-prereleases</url></pluginRepository></pluginRepositories>
+       <repositories><repository><id>v</id><url>https://maven.vaadin.com/vaadin-prereleases</url></repository></repositories>
        <dependencies>
                <dependency>
-                       <groupId>dev.hilla</groupId>
-                       <artifactId>hilla-react-spring-boot-starter</artifactId>
+                       <groupId>com.vaadin</groupId>
+                       <artifactId>vaadin-spring-boot-starter</artifactId>
                </dependency>

                <dependency>
@@ -38,9 +40,9 @@
        <dependencyManagement>
                <dependencies>
                        <dependency>
-                               <groupId>dev.hilla</groupId>
-                               <artifactId>hilla-bom</artifactId>
-                               <version>${hilla.version}</version>
+                               <groupId>com.vaadin</groupId>
+                               <artifactId>vaadin-bom</artifactId>
+                               <version>${vaadin.version}</version>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
@@ -50,9 +52,10 @@
        <build>
                <plugins>
                        <plugin>
-                               <groupId>dev.hilla</groupId>
-                               <artifactId>hilla-maven-plugin</artifactId>
-                               <version>${hilla.version}</version>
+                               <groupId>com.vaadin</groupId>
+                               <artifactId>vaadin-maven-plugin</artifactId>
+                               <configuration><reactEnable>false</reactEnable></configuration>
+                               <version>${vaadin.version}</version>
                                <executions>
                                        <execution>
                                                <id>frontend</id>
@@ -75,9 +78,10 @@
                        <build>
                                <plugins>
                                        <plugin>
-                                               <groupId>dev.hilla</groupId>
-                                               <artifactId>hilla-maven-plugin</artifactId>
-                                               <version>${hilla.version}</version>
+                                               <groupId>com.vaadin</groupId>
+                                               <artifactId>vaadin-maven-plugin</artifactId>
+                                               <configuration><reactEnable>false</reactEnable></configuration>
+                                               <version>${vaadin.version}</version>
                                                <executions>
                                                        <execution>
                                                                <id>frontend</id>
@@ -86,7 +90,6 @@

Versions

  • Vaadin / Flow version: 24.4.0.rc1
@manolo manolo changed the title PiT 24.4: when migrating a hilla project from 2.5.5 to 24.4.0.rc1 flow does not add the ` to package.json` PiT 24.4: when migrating a hilla project from 2.5.5 to 24.4.0.rc1 flow does not add the @vaadin/hilla-frontend to package.json Jun 6, 2024
@manolo
Copy link
Member Author

manolo commented Jun 6, 2024

So after some investigation, the problem happens when the project is migrated to 24.4.0.rc1 after it has been run at least once in version 2.5.5

The problem seems that in 2.5.5 there is a generated/connect-client.default.ts with the content:

import { ConnectClient as ConnectClient_1 } from "@vaadin/hilla-frontend";
const client_1 = new ConnectClient_1({ prefix: "connect" });
export default client_1;

Whereas in 24.4.0.rc1 the generated/connect-client.default.ts is not created

The workaround is to remove the generated folder or run mvn vaadin:dance

@manolo manolo changed the title PiT 24.4: when migrating a hilla project from 2.5.5 to 24.4.0.rc1 flow does not add the @vaadin/hilla-frontend to package.json PiT 24.4: when migrating a hilla project from 2.5.5 to 24.4.0.rc1 old stuff in generated folder fail compilation Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: 🔖 High Priority (P1)
Status: 🪵Product backlog
Development

No branches or pull requests

2 participants