Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(nextjs): bump Next.js version to 12.0.7 #7788

Merged
merged 1 commit into from
Dec 8, 2021

Conversation

puku0x
Copy link
Contributor

@puku0x puku0x commented Nov 18, 2021

Current Behavior

Next.js v12.0.0 is used.

Expected Behavior

Next.js v12.0.7 is used.

Related Issue(s)

Closes #7746

@vercel
Copy link

vercel bot commented Nov 18, 2021

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/nrwl/nx-dev/65Bd7HiEVWSpMjgMvCkzsWkWeXhj
✅ Preview: https://nx-dev-git-fork-puku0x-update-next-1204-nrwl.vercel.app

package.json Outdated Show resolved Hide resolved
package.json Outdated Show resolved Hide resolved
@@ -200,6 +200,19 @@
"alwaysAddToPackageJson": false
}
}
},
"13.3.0": {
"version": "13.3.0-beta.0",
Copy link
Contributor Author

@puku0x puku0x Nov 19, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is because Nx v13.3.0 supports the latest version of angular-eslint and I expect
it will be shipped soon. 512f094

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Next.js v12.0.5+ supports ESLint v8, which means this migration is suitable for Nx v13.3.0

@MitkoTschimev
Copy link
Contributor

Hi, everybody!

How long will it take to land into the next release?
Sorry for pushing but we really rely on this fix.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 6, 2021

As of v12.0.5, Next.js supports ESLint v8. I will update to the latest version (v12.0.7).
https://github.com/vercel/next.js/releases/tag/v12.0.5

@puku0x puku0x changed the title feat(nextjs): bump Next.js version to 12.0.4 feat(nextjs): bump Next.js version to 12.0.7 Dec 6, 2021
@@ -141,7 +141,7 @@
"ejs": "^3.1.5",
"enhanced-resolve": "^5.8.3",
"eslint": "8.2.0",
"eslint-config-next": "12.0.0",
"eslint-config-next": "12.0.7",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn upgrade [email protected]

@@ -188,7 +188,7 @@
"mime": "2.4.4",
"mini-css-extract-plugin": "^2.1.0",
"minimatch": "3.0.4",
"next": "12.0.0",
"next": "12.0.7",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yarn upgrade [email protected]

@puku0x
Copy link
Contributor Author

puku0x commented Dec 6, 2021

Does Next.js not allow Nx to override process.env.NODE_ENV ?
https://nx.app/runs/M1YuX0TWXjK

@kirjai I need your help to solve the build error.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 7, 2021

@kirjai Does Nrwl team has a plan to upgrate Next.js to 12.0.7? I think it is a great opportunity to upgrade it because Next.js v12.0.5 or later supports ESLint v8 which is the version that Nx v13.3.0 supports too.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 7, 2021

Something wrong in Nx Cloud? I will try it again later.

image

@kirjai
Copy link
Contributor

kirjai commented Dec 7, 2021

@puku0x this is great, thanks a lot for doing the work for this! i'd suggest pushing this branch again in hopes that that was a very temporary Nx Cloud hiccup. i'm not aware of any ongoing issues with it

@AgentEnder
Copy link
Member

@puku0x It looks like there is a few other locations with that NODE_ENV change, do you care to apply it in those too? 😞 I don't know why it would have just started.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 8, 2021

@AgentEnder Next.js recently added next/types/global.d.ts to next/index.d.ts in vercel/next.js#28316 , that's why NODE_ENV becomes readonly.

Fortunately, we don’t have to apply the cast to the others because it affects only the package using next.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 8, 2021

Fixed build.impl.ts and server.impl.ts.

@puku0x
Copy link
Contributor Author

puku0x commented Dec 8, 2021

😕

Next.js Applications › should support Less

    Command failed: pnpx nx build app6524812 --withDeps

    DEPRECATION WARNING: --with-deps is deprecated and it will be removed in v14.
    Configure target dependencies instead: https://nx.dev/latest/angular/core-concepts/configuration#target-dependencies.
          
    Cannot read property 'oneOf' of undefined

      436 |     const pm = getPackageManagerCommand();
      437 |     let r = stripConsoleColors(
    > 438 |       execSync(`${pm.runNx} ${command}`, {
          |               ^
      439 |         cwd: opts.cwd || tmpProjPath(),
      440 |         env: { ...(opts.env || process.env), NX_INVOKED_BY_RUNNER: undefined },
      441 |         encoding: 'utf-8',

      at runCLI (../utils/index.ts:438:15)
      at src/next.test.ts:613:29
      at ../../node_modules/tslib/tslib.js:117:75
      at __awaiter (../../node_modules/tslib/tslib.js:113:16)
      at checkApp (src/next.test.ts:416:34)
      at src/next.test.ts:286:11

  ● Next.js Applications › should support Stylus

    Command failed: pnpx nx build app6633046 --withDeps

    DEPRECATION WARNING: --with-deps is deprecated and it will be removed in v14.
    Configure target dependencies instead: https://nx.dev/latest/angular/core-concepts/configuration#target-dependencies.
          
    Cannot read property 'oneOf' of undefined

      436 |     const pm = getPackageManagerCommand();
      437 |     let r = stripConsoleColors(
    > 438 |       execSync(`${pm.runNx} ${command}`, {
          |               ^
      439 |         cwd: opts.cwd || tmpProjPath(),
      440 |         env: { ...(opts.env || process.env), NX_INVOKED_BY_RUNNER: undefined },
      441 |         encoding: 'utf-8',

      at runCLI (../utils/index.ts:438:15)
      at src/next.test.ts:613:29
      at ../../node_modules/tslib/tslib.js:117:75
      at __awaiter (../../node_modules/tslib/tslib.js:113:16)
      at checkApp (src/next.test.ts:416:34)
      at src/next.test.ts:299:11

Test Suites: 1 failed, 1 total
Tests:       2 failed, 14 passed, 16 total
Snapshots:   0 total
Time:        1005.679 s
Ran all test suites.
ERROR: Something went wrong in @nrwl/run-commands - Command failed: nx run-e2e-tests e2e-next

@puku0x
Copy link
Contributor Author

puku0x commented Dec 8, 2021

Something wrong with withLess and withStylus

@puku0x
Copy link
Contributor Author

puku0x commented Dec 8, 2021

withLess and withStylus should search the rule as following because Next.js uses Symbols for CSS rule.

  • Before (v12.0.0)
const cssRule = config.module.rules.find((rule) =>
  rule.oneOf?.find((r) => r?.options?.__next_css_remove)
);
  • After (v12.0.5)
const cssRule = config.module.rules.find((rule) =>
  rule.oneOf?.find((r) => r?.[Symbol.for('__next_css_remove')])
);

vercel/next.js#31078

Copy link
Contributor

@kirjai kirjai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

once again, thanks a lot for doing the work for this! really appreciated

@kirjai kirjai merged commit fe96a33 into nrwl:master Dec 8, 2021
@puku0x puku0x deleted the update-next-12.0.4 branch December 9, 2021 14:00
@github-actions
Copy link

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support Next.js 12.0.4
4 participants