wpengine / faustjs

Faust.js™ - The Headless WordPress Framework
https://faustjs.org
Other
1.44k stars 132 forks source link

Next JS 14.1.2 returns a build error for the experimental app router package #1834

Closed CesarBenavides777 closed 7 months ago

CesarBenavides777 commented 8 months ago

Description

When using the latest version of Next JS 14.1.2 fails to build when deployed on vercel:


Creating an optimized production build ...
--
11:36:41.361 | Failed to compile.
11:36:41.361 |  
11:36:41.362 | ./node_modules/@faustwp/experimental-app-router/dist/server/routeHandler/index.js + 2 modules
11:36:41.362 | Cannot get final name for export 'NextResponse' of ./node_modules/next/dist/api/server.js

image

Steps to reproduce

  1. Deploy a new change to github
  2. Await vercel build
  3. Error occurs

Additional context

Downgrading to Next 14.1.0 Fixes the build

@faustwp/core Version

^3.0.0

@faustwp/cli Version

^3.0.0

FaustWP Plugin Version

1.2.2

WordPress Version

Latest

Additional environment details

package.json

  "name": "book-of-free",
  "private": true,
  "type": "module",
  "scripts": {
    "dev": "faust dev --experimental-https --turbo",
    "build": "faust build",
    "generate": "faust generatePossibleTypes && yarn codegen",
    "clean": "rimraf .next node_modules yarn.lock",
    "stylesheet": "faust generateGlobalStylesheet",
    "start": "faust start",
    "codegen": "graphql-codegen --config graphql.config.yaml --errors-only",
    "format": "prettier --write './**/*.{js,jsx,md,mdx,css,scss,ts,tsx}' '!.next/**' '!out/**' '!possibleTypes.json' '!public/~partytown/**'",
    "format:check": "prettier --check './**/*.{js,jsx,md,mdx,css,scss,ts,tsx}'",
    "postinstall": "patch-package"
  },
  "dependencies": {
    "@apollo/client": "^3.9.5",
    "@apollo/experimental-nextjs-app-support": "^0.8.0",
    "@faustwp/cli": "^3.0.0",
    "@faustwp/core": "^3.0.0",
    "@faustwp/experimental-app-router": "^0.3.0",
    "@next/third-parties": "^14.1.2",
    "@radix-ui/react-icons": "^1.3.0",
    "@radix-ui/react-toast": "^1.1.5",
    "@stripe/react-stripe-js": "^2.5.1",
    "@stripe/stripe-js": "^3.0.7",
    "@types/gtag.js": "^0.0.19",
    "@vercel/og": "^0.6.2",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.0",
    "crypto-js": "^4.2.0",
    "deepmerge": "^4.3.1",
    "dotenv": "^16.4.5",
    "framer-motion": "^11.0.8",
    "graphql": "^16.8.1",
    "jwt-decode": "^4.0.0",
    "micro": "^10.0.1",
    "micro-cors": "^0.1.1",
    "next": "14.1.0",
    "next-sitemap": "^4.2.3",
    "patch-package": "^8.0.0",
    "react": "^18.3.0-canary-e1d20fc0c-20240122",
    "react-dom": "^18.3.0-canary-e1d20fc0c-20240122",
    "react-fast-marquee": "^1.6.4",
    "react-hook-form": "^7.51.0",
    "react-icons": "^5.0.1",
    "react-inlinesvg": "^4.1.3",
    "react-lite-youtube-embed": "^2.4.0",
    "react-pageflip": "^2.0.3",
    "react-select": "^5.8.0",
    "react-snap-carousel": "^0.4.0",
    "react-wrap-balancer": "^1.1.0",
    "sonner": "^1.4.3",
    "stripe": "^14.19.0",
    "tailwind-merge": "^2.2.1"
  },
  "engines": {
    "node": ">=18",
    "npm": ">=8"
  },
  "devDependencies": {
    "@graphql-codegen/cli": "^5.0.2",
    "@graphql-codegen/typescript-operations": "^4.2.0",
    "@graphql-codegen/typescript-react-apollo": "^4.3.0",
    "@svgr/webpack": "^8.1.0",
    "@tailwindcss/container-queries": "^0.1.1",
    "@tailwindcss/forms": "^0.5.7",
    "@tailwindcss/typography": "^0.5.10",
    "@types/apollo-upload-client": "^18.0.0",
    "@types/node": "^20.11.24",
    "@types/react": "^18.2.63",
    "@types/react-dom": "^18.2.20",
    "autoprefixer": "^10.4.18",
    "eslint": "^8.57.0",
    "eslint-config-airbnb": "19.0.4",
    "eslint-config-next": "^14.1.2",
    "eslint-config-prettier": "^9.1.0",
    "eslint-plugin-import": "^2.29.1",
    "eslint-plugin-jsx-a11y": "6.8.0",
    "eslint-plugin-prettier": "5.1.3",
    "eslint-plugin-react": "^7.34.0",
    "eslint-plugin-react-hooks": "^4.6.0",
    "eslint-plugin-unicorn": "^51.0.1",
    "eslint-plugin-unused-imports": "^3.1.0",
    "postcss": "^8.4.35",
    "prettier": "^3.2.5",
    "prettier-plugin-tailwindcss": "^0.5.12",
    "tailwindcss": "^3.4.1",
    "typescript": "^5.3.3"
  }
}

Please confirm that you have searched existing issues in the repo.

mdrayer commented 8 months ago

I am having the save issue (https://github.com/wpengine/faustjs/issues/1833), even on the example app-router app in the Faust repo.

theodesp commented 8 months ago

@mdrayer it looks like a Next.js build issue that happens if using next > v"14.1.0"

theodesp commented 8 months ago

@mdrayer @CesarBenavides777 Fix should be available in canary release.