From 4e54ca3088b11ee2b173b35b4f07704730c438d9 Mon Sep 17 00:00:00 2001 From: Shivam Sharma Date: Fri, 8 Dec 2023 20:08:37 +0530 Subject: [PATCH] NextJS 14 next export has been removed --- .../framework/override/NextFramework.java | 16 ++++++++++++---- docs/modules/ROOT/pages/web-frameworks.adoc | 9 ++++++++- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/deployment/src/main/java/io/quarkiverse/quinoa/deployment/framework/override/NextFramework.java b/deployment/src/main/java/io/quarkiverse/quinoa/deployment/framework/override/NextFramework.java index e3a6a418..2aacd17a 100644 --- a/deployment/src/main/java/io/quarkiverse/quinoa/deployment/framework/override/NextFramework.java +++ b/deployment/src/main/java/io/quarkiverse/quinoa/deployment/framework/override/NextFramework.java @@ -20,14 +20,21 @@ public NextFramework() { } @Override - public QuinoaConfig override(QuinoaConfig delegate, Optional packageJson, Optional detectedDevScript, + public QuinoaConfig override(QuinoaConfig delegate, Optional packageJson, + Optional detectedDevScript, boolean isCustomized) { if (delegate.packageManagerCommand().build().equals("run build") && packageJson.isPresent()) { JsonObject scripts = packageJson.get().getJsonObject("scripts"); if (scripts != null) { - if (!scripts.getString("build").contains("next export")) { + String buildScript = scripts.getString("build"); + if (buildScript == null || buildScript.isEmpty()) { LOG.warn( - "Make sure you define \"build\": \"next build && next export\", in the package.json to make Next work with Quinoa."); + "Make sure you define \"build\": \"next build \", in the package.json to make Next work with Quinoa."); + } + String output = packageJson.get().getString("output"); + if (!"export".equals(output)) { + LOG.warn( + "Make sure you define \"output\": \"export \", in the package.json to make Next work with Quinoa."); } } } @@ -38,7 +45,8 @@ public DevServerConfig devServer() { return new DevServerConfigDelegate(super.devServer()) { @Override public Optional indexPage() { - // In Dev mode Next.js serves everything out of root "/" but in PRD mode its the normal "/index.html". + // In Dev mode Next.js serves everything out of root "/" but in PRD mode its the + // normal "/index.html". return Optional.of(super.indexPage().orElse("/")); } }; diff --git a/docs/modules/ROOT/pages/web-frameworks.adoc b/docs/modules/ROOT/pages/web-frameworks.adoc index 7a64450e..39d4f442 100644 --- a/docs/modules/ROOT/pages/web-frameworks.adoc +++ b/docs/modules/ROOT/pages/web-frameworks.adoc @@ -202,10 +202,17 @@ This will configure the build to export the static files: ---- "scripts": { ... - "build": "next build && next export", + "build": "next build", } ---- +In Next.js 14+ you need to add the following property in `next.config.js` file: +---- +const nextConfig = { + output: 'export', +} +---- + [#svelte-kit-config] === Svelte Kit Configuration SvelteKit needs to be configured to create a single page application.