nx: React build breaks after migrating to 15.5.1

Current Behavior

After we migrated to v15.5.1 (from 15.4.4), a few of our React apps started failing on builds. There was a polyfill for node (which I couldn’t find in code history, but it might have been another polyfill) that does not exist anymore.

We are using a custom webpack configuration which is using the plugin from @nrwl/react/plugins/webpack.

I assume this is caused by one of those:

Expected Behavior

Should work as it previously did.

Github Repo

No response

Steps to Reproduce

  1. Create a repo with a React app
  2. Install graphql-request
  3. Use it anywhere in your code
  4. Run a build

Nx Report

Node : 16.16.0
   OS   : darwin arm64
   yarn : 3.3.1
   
   nx : 15.5.1
   @nrwl/angular : Not Found
   @nrwl/cypress : 15.5.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 15.5.1
   @nrwl/esbuild : Not Found
   @nrwl/eslint-plugin-nx : 15.5.1
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 15.5.1
   @nrwl/js : 15.5.1
   @nrwl/linter : 15.5.1
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : 15.5.1
   @nrwl/nx-cloud : 15.0.2
   @nrwl/nx-plugin : 15.5.1
   @nrwl/react : 15.5.1
   @nrwl/react-native : Not Found
   @nrwl/rollup : 15.5.1
   @nrwl/schematics : Not Found
   @nrwl/storybook : 15.5.1
   @nrwl/web : 15.5.1
   @nrwl/webpack : 15.5.1
   @nrwl/workspace : 15.5.1
   @nrwl/vite : 15.5.1
   typescript : 4.9.4
   ---------------------------------------
   Local workspace plugins:
         @island/workspace
   ---------------------------------------
   Community plugins:
         nx-stylelint: 14.0.2

Failure Logs

ERROR in ./node_modules/combined-stream/lib/combined_stream.js 2:13-37
Module not found: Error: Can't resolve 'stream' in '/Users/dan/work/apps/node_modules/combined-stream/lib'

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
        - add a fallback 'resolve.fallback: { "stream": require.resolve("stream-browserify") }'
        - install 'stream-browserify'
If you don't want to include a polyfill, you can use an empty module like this:
        resolve.fallback: { "stream": false }
 @ ./node_modules/graphql-request/node_modules/form-data/lib/form_data.js 1:21-47
 @ ./node_modules/graphql-request/dist/createRequestBody.js 7:34-54
 @ ./node_modules/graphql-request/dist/index.js 178:42-72
 @ ./apps/app/src/app/api/graphql/rpa-store-client.ts 1:0-38 9:40-43
 @ ./apps/app/src/features/foo/Drawer.tsx 31:0-33:48 134:6-19
 @ ./apps/app/src/components/Drawers/DrawerList.ts 19:0-67 152:46-60
 @ ./apps/app/src/components/Drawers/Drawers.tsx 5:0-42 11:18-28
 @ ./apps/app/src/app/App.tsx 5:0-56 25:314-321
 @ ./apps/app/src/index.tsx 5:0-35 17:216-226

Additional Information

No response

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 10
  • Comments: 23 (10 by maintainers)

Most upvoted comments

It is not mentioned or reported anywhere as a breaking change (and in a minor version), so I would not expect anything to break.

I confirm the migration to the 15.6.0 was flawless! Everything is back to normal. Thank you very much for the reactivity, you’re the bests!

@ZackTherrien That looks like a different issue.

@bdebon migrating to 15.4.4 works for me now.

According to my test it appeared in 15.4.6

Same issue on a react project. Was trying to migrate from 15.0.3 -> 15.5.2

Mentioning this here as potentially related?