flow: Cannot update from 24.1.12 to 24.2.0, error during build frontend

Description of the bug

Hello,

I want to upgrade from 24.1.12 to 24.2.0 but there is an error when frontend is build :

14:00:26 [vite] Internal server error: Failed to resolve import "@vaadin/grid/src/vaadin-grid-selection-column-base-mixin.js" from "frontend\generated\jar-resources\vaadin-grid-flow-selection-column.js". Does the file exist?
Plugin: vite:import-analysis
File: C:/pathToWorkspace/frontend/generated/jar-resources/vaadin-grid-flow-selection-column.js:3:47
1  |  import '@vaadin/grid/vaadin-grid-column.js';
2  |  import { GridColumn } from '@vaadin/grid/src/vaadin-grid-column.js';
3  |  import { GridSelectionColumnBaseMixin } from '@vaadin/grid/src/vaadin-grid-selection-column-base-mixin.js';
   |                                                ^
4  |  
5  |  class GridFlowSelectionColumn extends GridSelectionColumnBaseMixin(GridColumn) {
    at formatError (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:44055:46)
    at TransformContext.error (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:44051:19)
    at normalizeUrl (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:41837:33)
    at async file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:41991:47
    at async Promise.all (index 2)
    at async TransformContext.transform (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:41907:13)
    at async Object.transform (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:44345:30)
    at async loadAndTransform (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:55015:29)
    at async viteTransformMiddleware (file:///C:/pathToWorkspace/node_modules/.pnpm/vite@4.4.11/node_modules/vite/dist/node/chunks/dep-2b82a1ce.js:64417:32)

I delete node_modules, package.json, pnpm-lock.yaml, vite.generated.ts and restart app, no effect.

Thanks

Expected behavior

Frontend build fine

Minimal reproducible example

I can’t share my project

Versions

  • Vaadin / Flow version: 24.2.0
  • Java version: 17
  • OS version: windows 10
  • Browser version : chrome 118.0.5993.89
  • IDE : eclipse 2023-09 (4.29.0)

About this issue

  • Original URL
  • State: closed
  • Created 8 months ago
  • Reactions: 2
  • Comments: 39 (15 by maintainers)

Most upvoted comments

Could you check if you have .pnpmfile.cjs in your project root folder? If you do, delete it and rerun the build with pnpm. This fixed the issue for me.

Deleting the .pnpmfile.cjs worked for me as well

Edit// It was already in our .gitignore, I just had it locally still flying around from the previous version

A bit more context: .pnpmfile.cjs is no longer generated by Vaadin Flow in 24.2+ versions, so V24.2+ works fine itself. Vaadin 24.1 generates this file, but apparently uses older versions of Node.js/npm/pnpm, with that it doesn’t have this buggy behaviour.

The action proposed for Flow is to add this file into vaadin:clean-frontend goal (for Gradle also), and backport this change into all versions that generate this file. So that whenever you migrate to Vaadin 24.2+ you can run mvn clean; mvn vaadin:clean-frontend and avoid this issue.

I delete node_module and replace package.json with older version (24.1.12) and add parameter pnpm.enable = false. Frontend is build correctly after that and I can find the file @vaadin/grid/src/vaadin-grid-selection-column-base-mixin.js.

I use default pnpm automatically used by Vaadin.

Tested upgrade from 24.1.12 to 24.2.0 on a clean environment. While using npm I could not reproduce the issue either in dev or prod mode. Cleaning again, switching to pnpm, and running the same upgrade process I was able to reproduce the issue, so it might be occurring on pnpm only.