Open MichaelF25 opened 9 months ago
Seems like it is related to https://github.com/vaadin/vcf-nav/issues/33
@MichaelF25 yeah, that plugin might be a reason. The recommendation is to use SideNav
.
Vite version has been changed from 4 to 5 between Vaadin 23 and 24.
This new version of Vite requires decorators like customElement
, property
to be exported from lit/decorators.js
with explicit .js
extension.
Your project misses .js
somewhere in JS codes in an import, that can be a reason.
Or, any of the third-party JS components used in your project have lit/decorators
without .js
.
Also, please check the browser logs for this kind of message:
Warning: the file ${id} imports from '${decoratorMatch[3]}' when it should import from '${decoratorMatch[3]}.js'
or
Warning: the file ${id} imports from '${directiveMatch[3]}${directiveMatch[4]}' when it should import from '${directiveMatch[3]}${directiveMatch[4]}.js'
See this PR for more insights: https://github.com/vaadin/flow/pull/14449.
It actually broke in minor version. It's working for me in 24.2.5 and failing in 24.3.3 which is pretty bad behavior for a minor version in my opinion.
vite v5.0.6 building for production...
transforming...
✓ 495 modules transformed.
Expression expected (Note that you need plugins to import files that are not JavaScript)
file: /home/felix/Development/ravc/node_modules/@vaadin-component-factory/vcf-nav/src/vcf-nav.ts:13:0
11: let id = 0;
12:
13: @customElement('vcf-nav')
^
14: export class Nav extends LitElement {
15: @property({ type: Boolean, reflect: true })
error during build:
RollupError: Expression expected
at error (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:337:30)
at parseError (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:972:9)
at convertNode (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:2061:12)
at convertProgram (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:965:12)
at parseAstAsync (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/parseAst.js:2112:12)
at async Module.tryParseAsync (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:13571:20)
at async Module.setSource (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:13152:35)
at async ModuleLoader.addModuleSource (file:///home/felix/Development/ravc/node_modules/vite/node_modules/rollup/dist/es/shared/node-entry.js:17847:13)
I also encountered this problem when upgrading from 24.3.3 to 24.3.11. The following commands helped me:
mvn clean vaadin:clean-frontend
del /f/s/q package-lock.json package.json tsconfig.json types.d.ts vite.config.ts vite.generated.ts
mvn -DskipTests install
mvn vaadin:build-frontend
mvn spring-boot:run
At the same time, attempts to launch from under the IDE were unsuccessful. It was the first launch from the command line that magically solved the problem! After this, it became possible to work in IDE.
Need to be retested against latest Vaadin version
This time I skipped the step of confirming that the problem was still present and simply ran the script I had prepared earlier. The update was successful from 24.3.11 to 24.4.7. Then I also updated Spring Boot smoothly from 3.2.5 to 3.3.2.
Description of the bug
I am currently upgrading my rather big maven multi-module app from Vaadin23 with Spring Boot 2.7 to latest Vaadin 24.3.3 with Spring Boot 3.2.1. So far the application starts up fine, but as soon as I try to access the UI, the following error with stack trace is displayed:
I've also noticed at application startup following error which is maybe related:
I've also tried to clean everything via
mvn clean
andmvn vaadin:clean-frontend
as well as removing any old node or npm installations without success.Versions: