Skip to content

frontend compilation fails after upgrading to vaadin 23.1.0 #13952

Closed

Description

@bsutton

Description of the bug

After upgrading to vaadin 23.1.0 I ran:

rm -rf target
rm -rf node_modules
npm i
mvn install

When I try to restart tomcat I get the following error:

13 12:57:22,617 http-nio-8080-exec-1 USER: [ERROR] (CustomExceptionHandler.java:36) - Uncaught UI exception
�[m java.lang.IllegalStateException: Startup of Webpack failed. Output was:
[webpack-cli] TypeError: cli.isMultipleCompiler is not a function
    at Command.<anonymous> (/home/bsutton/git/onepub/onepub_vaadin/node_modules/.pnpm/@webpack-cli+serve@1.7.0_8b27d5839a2bdf89ba2338e4c89fea10/node_modules/@webpack-cli/serve/lib/index.js:146:35)
    at async Promise.all (index 1)
    at async Command.<anonymous> (/home/bsutton/git/onepub/onepub_vaadin/node_modules/.pnpm/webpack-cli@4.9.2_9c3dcbfb57ee5c2fcb4d4b626946cc9c/node_modules/webpack-cli/lib/webpack-cli.js:1674:7)

	at com.vaadin.base.devserver.AbstractDevServerRunner.doStartDevModeServer(AbstractDevServerRunner.java:219) ~[vaadin-dev-server-23.1.0.jar:?]
	at com.vaadin.base.devserver.AbstractDevServerRunner.runOnFutureComplete(AbstractDevServerRunner.java:171) ~[vaadin-dev-server-23.1.0.jar:?]
	at com.vaadin.base.devserver.AbstractDevServerRunner.lambda$new$0(AbstractDevServerRunner.java:162) ~[vaadin-dev-server-23.1.0.jar:?]
	at java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863) ~[?:?]
	at java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841) ~[?:?]
	at java.util.concurrent.CompletableFuture$Completion.exec(CompletableFuture.java:483) ~[?:?]
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:373) ~[?:?]
	at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1182) ~[?:?]
	at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1655) ~[?:?]
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1622) ~[?:?]
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:165) ~[?:?]

Expected behavior

tomcat should start without an error.

Minimal reproducible example

After upgrading to vaadin 23.1.0 I ran:

rm -rf target
rm -rf node_modules
npm i
mvn install

Versions

  • Vaadin / Flow version: 23.1.0
  • Java version: OpenJDK 64-Bit Server VM (build 17.0.3+7-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)
  • OS version: Ubuntu: 22.04
  • Browser version (if applicable):
  • Application Server (if applicable): Apache Tomcat/9.0.36
  • IDE (if applicable): eclipse

Activity

  1. bsutton commented on Jun 13, 2022

    @bsutton
    Author

    So I switched to vite (by manually configuring the properties file) which bypassed the above error.
    However, I'm now getting the following error:

    13 13:14:12,980 ForkJoinPool.commonPool-worker-1 USER: [INFO] (TaskCopyFrontendFiles.java:66) - Copying frontend resources from jar files ...
    �[m�[39m13 13:14:13,002 ForkJoinPool.commonPool-worker-1 USER: [INFO] (TaskCopyFrontendFiles.java:91) - Visited 27 resources. Took 22 ms.
    �[m�[39m13 13:14:13,095 ForkJoinPool.commonPool-worker-1 USER: [INFO] (AbstractDevServerRunner.java:205) - Starting Vite
    �[m�[39m13 13:14:13,123 ForkJoinPool.commonPool-worker-1 USER: [INFO] (FrontendTools.java:541) - The globally installed Node.js version 12.22.9 is older than the required minimum version 16.14.0. Using Node.js from /home/bsutton/.vaadin.
    �[m�[38;5;35m
    ------------------ Starting Frontend compilation. ------------------
    �[0m�[39m13 13:14:13,321 ForkJoinPool.commonPool-worker-1 USER: [INFO] (AbstractDevServerRunner.java:389) - Running Vite to compile frontend resources. This may take a moment, please stand by...
    �[m�[39m13 13:14:13,863 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - Searching themes folder '/home/bsutton/git/onepub/onepub-vaadin/frontend/themes' for theme 'OnePub'
    �[m�[39m13 13:14:13,863 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - no assets to handle no static assets were copied
    �[m�[39m13 13:14:13,874 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - Found theme files from '/home/bsutton/git/onepub/onepub-vaadin/frontend/themes'
    �[m�[39m13 13:14:14,036 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - @rollup/plugin-replace: 'preventAssignment' currently defaults to false. It is recommended to set this option to `true`, as the next major version will default this option to `true`.
    �[m�[39m13 13:14:14,380 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:14,380 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -   vite v2.9.1 dev server running at:
    �[m�[39m13 13:14:14,381 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:14,381 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -   > Local: http://localhost:35661/VAADIN/
    �[m�[39m13 13:14:14,381 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -   > Network: use `--host` to expose
    �[m�[39m13 13:14:14,381 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:14,381 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -   ready in 1031ms.
    �[m�[38;5;35m
    ----------------- Frontend compiled successfully. -----------------
    
    �[0m�[39m13 13:14:14,381 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:14,381 ForkJoinPool.commonPool-worker-1 USER: [INFO] (AbstractDevServerRunner.java:223) - Started Vite. Time: 1286ms
    �[m�[39m13 13:14:16,119 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:16,119 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -  ERROR(TypeScript)  Cannot find module './theme' or its corresponding type declarations.
    �[m�[39m13 13:14:16,119 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -  FILE  /home/bsutton/git/onepub/onepub_vaadin/frontend/generated/vaadin.ts:7:28
    �[m�[39m13 13:14:16,119 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:16,119 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -     5 | import '@vaadin/flow-frontend/vaadin-dev-tools.js';
    �[m�[39m13 13:14:16,119 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -     6 |
    �[m�[39m13 13:14:16,120 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -   > 7 | import { applyTheme } from './theme';
    �[m�[39m13 13:14:16,120 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -       |                            ^^^^^^^^^
    �[m�[39m13 13:14:16,120 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -     8 | applyTheme(document);
    �[m�[39m13 13:14:16,120 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) -     9 |
    �[m�[39m13 13:14:16,120 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:14:16,120 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - Found 1 error. Watching for file changes.
    �[m
    

    I have had this error with earlier versions of vaadin 23, but it seems to come and go.

  2. bsutton commented on Jun 13, 2022

    @bsutton
    Author

    Possibly helpful?

    I have a file theme.js:

    import {applyTheme as _applyTheme} from './theme-OnePub.generated.js';
    export const applyTheme = _applyTheme;
    

    There is a largis generated file called
    theme-OnePub.generated.js

    And vaadin.ts contains:

    import './vaadin-featureflags.ts';
    
    import './index';
    
    import '@vaadin/flow-frontend/vaadin-dev-tools.js';
    
    import { applyTheme } from './theme';
    applyTheme(document);
    
    
  3. bsutton commented on Jun 13, 2022

    @bsutton
    Author

    I deleted frontend/generated.
    After running mvn install I ended up with an index.ts which contained an error:

    imports: () => import('../../target/frontend/generated-flow-imports')

    The generated-flow-imports file doesn't exist.

  4. bsutton commented on Jun 13, 2022

    @bsutton
    Author

    I ignored the above error and tried to start tomcat.
    I'm now getting:

    13 13:26:04,537 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - The request url "/home/bsutton/git/onepub/onepub_vaadin/frontend/generated/vaadin.ts" is outside of Vite serving allow list.
    �[m�[39m13 13:26:04,537 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:26:04,537 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub-vaadin/frontend
    �[m�[39m13 13:26:04,538 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub_vaadin/target/flow-frontend
    �[m�[39m13 13:26:04,538 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub_vaadin/target/frontend
    �[m�[39m13 13:26:04,538 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub-vaadin/node_modules
    �[m�[39m13 13:26:04,538 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub-vaadin/frontend
    �[m�[39m13 13:26:04,539 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub_vaadin/target/flow-frontend
    �[m�[39m13 13:26:04,539 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub_vaadin/target/frontend
    �[m�[39m13 13:26:04,539 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub-vaadin/node_modules
    �[m�[39m13 13:26:04,539 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - - /home/bsutton/git/onepub/onepub_vaadin/node_modules/.pnpm/vite@2.9.1/node_modules/vite/dist/client
    �[m�[39m13 13:26:04,540 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:26:04,540 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - Refer to docs https://vitejs.dev/config/#server-fs-allow for configurations and more details.
    �[m�[39m13 13:26:04,540 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - 
    �[m�[39m13 13:26:04,637 dev-server-output USER: [INFO] (DevServerOutputTracker.java:110) - The request url "/home/bsutton/git/onepub/onepub_vaadin/frontend/generated/vaadin.ts" is outside of Vite serving allow list.
    
  5. caalador commented on Jun 13, 2022

    @caalador
    Contributor

    It would seem that webpack-cli 4.9 is not compatible with cli/serve 1.7 see webpack/webpack-cli#3294

    As a workaround before a fix, defining the @webpack-cli/serve package.json dependency to v1.6.1 should fix the initial problem.

  6. self-assigned this
    on Jun 13, 2022
  7. enver-haase commented on Jun 13, 2022

    @enver-haase
    Contributor

    It would seem that webpack-cli 4.9 is not compatible with cli/serve 1.7 see webpack/webpack-cli#3294

    As a workaround before a fix, defining the @webpack-cli/serve package.json dependency to v1.6.1 should fix the initial problem.

    I had more luck with version 4.10.0 as in #13954.

  8. 9 remaining items

  9. Artur- commented on Jun 14, 2022

    @Artur-
    Member

    Instead of downgrading, maybe upgrading is easier

    npm i webpack-cli@^4.10.0
    
  10. enver-haase commented on Jun 14, 2022

    @enver-haase
    Contributor

    it is

    Instead of downgrading, maybe upgrading is easier

    npm i webpack-cli@^4.10.0
    
  11. stefanuebe commented on Jun 15, 2022

    @stefanuebe
    Contributor

    Since Vaadin 22 is also still maintained, we also need to provide the fix there.

  12. stefanuebe commented on Jun 15, 2022

    @stefanuebe
    Contributor

    Instead of downgrading, maybe upgrading is easier

    npm i webpack-cli@^4.10.0
    

    Works also for Vaadin 22.

  13. vaadin-bot commented on Jun 16, 2022

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 22.0.17.

  14. enver-haase commented on Jun 16, 2022

    @enver-haase
    Contributor

    Dear Vaadin-Bot, which version is this in Vaadin 23 terms?

  15. mstahv commented on Jun 17, 2022

    @mstahv
    Member

    23.1.1 is fresh out of oven.

  16. mshabarov commented on Jun 17, 2022

    @mshabarov
    Contributor

    This issue has been fixed in V23.1.1, V23.0.12 and V22.0.17.

    Vaadin 14.8 and 10.0 have no such an issue.

    Please let us know if you still experience any issues with webpack-cli by commenting to this ticket or creating a new one.

  17. mshabarov commented on Jun 17, 2022

    @mshabarov
    Contributor

    @bsutton could you create a separate ticket for the Vite errors you've experienced ?

    I'm going to close this ticket.

  18. bsutton commented on Jun 17, 2022

    @bsutton
    Author
  19. vaadin-bot commented on Jun 17, 2022

    @vaadin-bot
    Collaborator

    This ticket/PR has been released with Vaadin 23.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions