next.js icon indicating copy to clipboard operation
next.js copied to clipboard

cssLoader.issuer field removal is causing build processes depending on it to fail

Open terrymun opened this issue 2 years ago • 6 comments

Verify canary release

  • [X] I verified that the issue exists in the latest Next.js canary release

Provide environment information

Operating System: Platform: darwin Arch: x64 Version: Darwin Kernel Version 21.6.0: Mon Aug 22 20:17:10 PDT 2022; root:xnu-8020.140.49~2/RELEASE_X86_64 Binaries: Node: 16.18.0 npm: 8.19.2 Yarn: 3.1.1 pnpm: N/A Relevant packages: next: 13.0.1 eslint-config-next: 13.0.1 react: 18.2.0 react-dom: 18.2.0

What browser are you using? (if relevant)

No response

How are you deploying your application? (if relevant)

Nx

Describe the Bug

Upgrading from [email protected] to [email protected] will cause the following packages that rely on NextJs to fail:

  • next-transpile-modules
  • Nx plugin for NextJs

The reason being that these two dependencies (and probably others) rely on the cssLoader.issuer field that has been removed in this PR: https://github.com/vercel/next.js/pull/42106/files

Both next-transpile-modules and Nx plugin for NextJs seem to rely on this field to perform the bundling.

Expected Behavior

The build process should work (as per [email protected]). However, the build processes fails with [email protected] due to the removal of the issuer field in the exposed CSS loader.

Link to reproduction

https://github.com/terrymun/nextjs-cssloader-issuer

To Reproduce

  1. Checkout the repository at https://github.com/terrymun/nextjs-cssloader-issuer
  2. Notice that next-transpile-modules has been installed and is used to transpile lodash as an example
  3. Run npm run dev. The error message will appear TypeError: Cannot read properties of undefined (reading 'and'), as the issuer field has been removed as of [email protected]
  4. Downgrade to [email protected] by running npm install -D [email protected]
  5. Rerun npm run dev, and notice the server starts normally.

terrymun avatar Nov 01 '22 12:11 terrymun

I think this should be solved at next-transpile-modules level tbh. It's a little bit hard for the Next.js maintainers to test every plugin out there.

I should have a working copy soon.

martpie avatar Nov 01 '22 13:11 martpie

@martpie That's lovely :)

I am wondering though, if this should've been a breaking change, as this only only affects your package but also breaks Nx as well, which many people are also using.

terrymun avatar Nov 01 '22 13:11 terrymun

I don't know Nx at all tbh. The good news is the Next.js team is actively working on implementing next-transpile-modules natively. So we should hopefully not have to care about this kind of regressions in the future :]

https://github.com/vercel/next.js/discussions/42136

martpie avatar Nov 01 '22 13:11 martpie

@martpie @terrymun just to confirm I have now got this issue after upgrading from 13.0.0 to 13.0.1 today. I am using next-transpile-modules which is required to use amcharts4.

chrishornmem avatar Nov 01 '22 14:11 chrishornmem

Fixed in [email protected], cheers!

martpie avatar Nov 01 '22 16:11 martpie

@martpie confirmed working on my side after upgrading to [email protected]. Many thanks for super fast turnaround :)

chrishornmem avatar Nov 01 '22 16:11 chrishornmem