diff --git a/packages/nextjs/package.json b/packages/nextjs/package.json index f1e1ffae40fd..d981551304ca 100644 --- a/packages/nextjs/package.json +++ b/packages/nextjs/package.json @@ -37,7 +37,7 @@ "next": "10.1.3" }, "peerDependencies": { - "next": "^10.0.8 || ^11.0 || ^12.0", + "next": "^10.0.8 || ^11.0 || ^12.0 || ^13.0", "react": "15.x || 16.x || 17.x || 18.x", "webpack": ">= 4.0.0" }, diff --git a/packages/nextjs/test/run-integration-tests.sh b/packages/nextjs/test/run-integration-tests.sh index 9ca5e776c300..62033d3982ad 100755 --- a/packages/nextjs/test/run-integration-tests.sh +++ b/packages/nextjs/test/run-integration-tests.sh @@ -30,7 +30,7 @@ echo "Running integration tests on Node $NODE_VERSION" # make a backup of our config file so we can restore it when we're done mv next.config.js next.config.js.bak -for NEXTJS_VERSION in 10 11 12; do +for NEXTJS_VERSION in 10 11 12 13; do # export this to the env so that we can behave differently depending on which version of next we're testing, without # having to pass this value from function to function to function to the one spot, deep in some callstack, where we @@ -44,8 +44,14 @@ for NEXTJS_VERSION in 10 11 12; do fi # Next.js v11 requires at least Node v12 - if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -eq "11" ]; then - echo "[nextjs$NEXTJS_VERSION] Not compatible with Node $NODE_MAJOR" + if [ "$NODE_MAJOR" -lt "12" ] && [ "$NEXTJS_VERSION" -ge "11" ]; then + echo "[nextjs@$NEXTJS_VERSION] Not compatible with Node $NODE_MAJOR" + exit 0 + fi + + # Next.js v13 requires at least Node v14 + if [ "$NODE_MAJOR" -lt "14" ] && [ "$NEXTJS_VERSION" -ge "13" ]; then + echo "[nextjs@$NEXTJS_VERSION] Not compatible with Node $NODE_MAJOR" exit 0 fi @@ -61,6 +67,11 @@ for NEXTJS_VERSION in 10 11 12; do else sed -i /"next.*latest"/s/latest/"${NEXTJS_VERSION}.x"/ package.json fi + + # Next.js v13 requires React 18.2.0 + if [ "$NEXTJS_VERSION" -eq "13" ]; then + npm i --save react@18.2.0 react-dom@18.2.0 + fi # We have to use `--ignore-engines` because sucrase claims to need Node 12, even though tests pass just fine on Node # 10 yarn --no-lockfile --ignore-engines --silent >/dev/null 2>&1 @@ -84,11 +95,11 @@ for NEXTJS_VERSION in 10 11 12; do # https://github.com/webpack/webpack/issues/14532#issuecomment-947513562 # Context: https://github.com/vercel/next.js/issues/30078#issuecomment-947338268 if [ "$NODE_MAJOR" -gt "17" ] && [ "$WEBPACK_VERSION" -eq "4" ]; then - echo "[nextjs$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION" + echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION" exit 0 fi if [ "$NODE_MAJOR" -gt "17" ] && [ "$NEXTJS_VERSION" -eq "10" ]; then - echo "[nextjs$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION" + echo "[nextjs@$NEXTJS_VERSION | webpack@$WEBPACK_VERSION] Node $NODE_MAJOR not compatible with Webpack $WEBPACK_VERSION" exit 0 fi