|
83 | 83 | import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_INITIAL_UIDL;
|
84 | 84 | import static com.vaadin.flow.server.InitParameters.SERVLET_PARAMETER_PRODUCTION_MODE;
|
85 | 85 | import static com.vaadin.flow.server.frontend.FrontendUtils.GENERATED;
|
86 |
| -import static com.vaadin.flow.server.frontend.FrontendUtils.NODE_MODULES; |
87 | 86 | import static com.vaadin.flow.server.frontend.FrontendUtils.TOKEN_FILE;
|
88 | 87 |
|
89 | 88 | /**
|
@@ -521,17 +520,26 @@ public static void runFrontendBuild(PluginAdapterBase adapter)
|
521 | 520 | */
|
522 | 521 | public static void runVite(PluginAdapterBase adapter,
|
523 | 522 | FrontendTools frontendTools) throws TimeoutException {
|
524 |
| - runFrontendBuildTool(adapter, frontendTools, "Vite", "vite/bin/vite.js", |
| 523 | + runFrontendBuildTool(adapter, frontendTools, "Vite", "vite", "vite", |
525 | 524 | Collections.emptyMap(), "build");
|
526 | 525 | }
|
527 | 526 |
|
528 | 527 | private static void runFrontendBuildTool(PluginAdapterBase adapter,
|
529 |
| - FrontendTools frontendTools, String toolName, String executable, |
530 |
| - Map<String, String> environment, String... params) |
531 |
| - throws TimeoutException { |
| 528 | + FrontendTools frontendTools, String toolName, String packageName, |
| 529 | + String binaryName, Map<String, String> environment, |
| 530 | + String... params) throws TimeoutException { |
532 | 531 |
|
533 |
| - File buildExecutable = new File(adapter.npmFolder(), |
534 |
| - NODE_MODULES + executable); |
| 532 | + File buildExecutable; |
| 533 | + try { |
| 534 | + buildExecutable = frontendTools.getNpmPackageExecutable(packageName, |
| 535 | + binaryName, adapter.npmFolder()).toFile(); |
| 536 | + } catch (FrontendUtils.CommandExecutionException e) { |
| 537 | + throw new IllegalStateException(String.format(""" |
| 538 | + Unable to locate %s executable. Expected the "%s" npm \ |
| 539 | + package to be installed and to provide the "%s" binary. \ |
| 540 | + Double check that the npm dependencies are installed.""", |
| 541 | + toolName, packageName, binaryName)); |
| 542 | + } |
535 | 543 | if (!buildExecutable.isFile()) {
|
536 | 544 | throw new IllegalStateException(String.format(
|
537 | 545 | "Unable to locate %s executable by path '%s'. Double"
|
|
0 commit comments