Update: Bug
I filed Issue ticket # 6,629. Determined there to be a bug, with some details explained.
I leave this Question open in case anyone has a workaround.
tl;dr
Some part of the Vaadin 14 Maven-driven build process is ignoring the <build><directory>
setting in my Maven POM file, something to do with:
target
frontend
generated-flow-imports.js
package.json
Perhaps I should file a bug-report. Or is there a solution/workaround?
Details
I am using Vaadin 14.0.7 or 14.1.0alpha2 to build some web apps. I would like to use a ramdisk (a.k.a. RAM drive) to speed up the build process, and also to avoid wear-and-tear on my flash storage.
With this Question, I am able to mount a 1 gig ramdisk on macOS Mojave on a Mac mini.
diskutil partitionDisk $(hdiutil attach -nomount ram://2097152) 1 GPTFormat APFS 'RamDisk' '100%'
With this Answer, I edited my Maven POM file to get IntelliJ to build using a target
folder on the ramdisk.
- To the
<properties>
element add:<buildDirectory>/Volumes/RamDisk/target</buildDirectory>
- To the
<build>
element, add:<directory>${buildDirectory}</directory>
After running a Maven install
, I can see the build succeeded there, with all the expected folders and a WAR file.
The problem comes when I tried to run my project from within IntelliJ using the Jetty server bundled with IntelliJ, by running from the Maven pane the jetty:run
item. I saw much of the expected output in the Run
pane of IntelliJ. But after much of the webpack
lines, I got a Frontend compilation failed
error:
[webpack] INFO dev-webpack - build/webcomponentsjs/webcomponents-loader.js 6.13 KiB [emitted]
[webpack] INFO dev-webpack -
[webpack] ERROR dev-webpack - ERROR in Entry module not found: Error: Can't resolve '/Volumes/RamDisk/target/frontend/generated-flow-imports.js' in '/Users/basilbourque/IdeaProjects/ticktock/frontend'
[webpack] ERROR dev-webpack -
[webpack] ERROR dev-webpack - ERROR in Entry module not found: Error: Can't resolve '/Volumes/RamDisk/target/frontend/generated-flow-imports.js' in '/Users/basilbourque/IdeaProjects/ticktock/frontend'
[webpack] ERROR dev-webpack - ℹ 「wdm」: Failed to compile.
[webpack] ERROR dev-webpack -
------------------ Frontend compilation failed. -----------------
The /Volumes/RamDisk/target/frontend/
folder does exist on the ramdisk. But no generated-flow-imports.js
file is found within.
The Vaadin web-app does manage to run on the server. When pointing my web browser to that web app, I can see my expected web page displayed, but mostly covered by a long error message in a box with red text, all about a “Webpack Error”.
On the ramdisk, there is a folder named frontend
being created inside the target
folder. It contains only a single file, package.json
.
Screenshot of ramdisk:
Most of the expected stuff appears on the ramdisk in target
folder. But on the flash storage, a target
folder is being created, with a frontend
folder nested inside with a pair of files: generated-flow-imports.js
& package.json
. So it would seem there is some part of the Vaadin project build that is ignoring the <build><directory>
setting in my Maven POM file.
Screenshot of flash storage:
If I go back to the POM to comment-out my
<directory>${buildDirectory}</directory>
, all is well again, able to run my Vaadin web app via the bundled Jetty without any "frontend" or "webpack" errors.
➥ What can I do to get the frontend-compilation to work with my ramdisk?