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

Using next@13.0.1 causes build to fail due to nextCssLoader.issuer being undefined #12916

Closed
terrymun opened this issue Nov 1, 2022 · 5 comments
Labels

Comments

@terrymun
Copy link

terrymun commented Nov 1, 2022

Current Behavior

Running yarn build will fail after upgrading from next@13.0.0 to next@13.0.1.

Expected Behavior

The build process should run without issue: this is a regression because it used to work with next@13.0.0 installed.

Steps to Reproduce

Any routine installation will work, then upgrading the NextJs version to use 13.0.1 will cause the build to fail. The error comes from the with-nx.ts file reliance on the issuer field (https://github.com/nrwl/nx/blob/master/packages/next/plugins/with-nx.ts#L83), which has been removed in next@13.0.1: https://github.com/vercel/next.js/pull/42106/files

Failure Logs

TypeError: Cannot read properties of undefined (reading 'and')
  at webpack (/[REDACTED_PATH_TO_REPO]/node_modules/@nrwl/next/plugins/with-nx.js:53:64)
  at Object.config.webpack (/[REDACTED_PATH_TO_REPO]/node_modules/@nrwl/next/src/utils/config.js:60:163)
  at Object.getBaseWebpackConfig [as default] (/[REDACTED_PATH_TO_REPO]/node_modules/next/dist/build/webpack-config.js:1402:32)
  at async Promise.all (index 0)
  at async Span.traceAsyncFn (/[REDACTED_PATH_TO_REPO]/node_modules/next/dist/trace/trace.js:79:20)
  at async /[REDACTED_PATH_TO_REPO]/node_modules/next/dist/build/index.js:448:33
  at async /[REDACTED_PATH_TO_REPO]/node_modules/next/dist/build/index.js:433:13
  at async Span.traceAsyncFn (/[REDACTED_PATH_TO_REPO]/node_modules/next/dist/trace/trace.js:79:20)
  at async build (/[REDACTED_PATH_TO_REPO]/node_modules/next/dist/build/index.js:64:29)

Environment

Node : 16.18.0
OS   : darwin x64
yarn : 3.1.1

nx : 15.0.4
@nrwl/angular : Not Found
@nrwl/cypress : 15.0.4
@nrwl/detox : Not Found
@nrwl/devkit : 15.0.4
@nrwl/esbuild : 15.0.4
@nrwl/eslint-plugin-nx : 15.0.4
@nrwl/expo : Not Found
@nrwl/express : Not Found
@nrwl/jest : 15.0.4
@nrwl/js : 15.0.4
@nrwl/linter : 15.0.4
@nrwl/nest : Not Found
@nrwl/next : 15.0.4
@nrwl/node : 15.0.4
@nrwl/nx-cloud : 15.0.0
@nrwl/nx-plugin : Not Found
@nrwl/react : 15.0.4
@nrwl/react-native : Not Found
@nrwl/rollup : 15.0.4
@nrwl/schematics : Not Found
@nrwl/storybook : 15.0.4
@nrwl/web : 15.0.4
@nrwl/webpack : 15.0.4
@nrwl/workspace : 15.0.4
typescript : 4.8.4
---------------------------------------
Local workspace plugins:
---------------------------------------
Community plugins:
      lerna: 6.0.1
@violabg
Copy link

violabg commented Nov 1, 2022

related #12912

@FrozenPandaz FrozenPandaz added the scope: nextjs Issues related to NextJS support for Nx label Nov 3, 2022
@FrozenPandaz
Copy link
Collaborator

Could you please link a repo we can use to reproduce the issue? It will help us identify the cause and fix it faster.

@smonn
Copy link

smonn commented Nov 3, 2022

@FrozenPandaz I'm having the same issue, here's a repo with it reproduced: https://github.com/smonn/repro-nx-and-nextjs

As @violabg commented, I think #12912 is related.

Update: still an issue in Next.js v13.0.2 and Nx v15.0.9

Miikis added a commit to Miikis/nx that referenced this issue Nov 5, 2022
Next.js v13+ removed the 'issuer' field from their css/sass loaders. This breaks the nx-next plugin
'withNx'. This PR just adds a check to ensure the 'issuer' field is still there. Not the most robust
fix but it should at least maintain backwards-compatibility w/ folks using next.js < 13.

ISSUES CLOSED: nrwl#12916, nrwl#12912
@jaysoo
Copy link
Member

jaysoo commented Nov 7, 2022

Merged this PR #12973 which will fix this issue.

@jaysoo jaysoo closed this as completed Nov 7, 2022
@github-actions
Copy link

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

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

Successfully merging a pull request may close this issue.

5 participants