question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Use of deprecated webpack DevServer onBeforeSetupMiddleware and onAfterSetupMiddleware options

See original GitHub issue

Steps to reproduce

npx create-react-app my-app
cd my-app
npm start

Unexpected output

(node:22848) [DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE] DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.
(Use `node --trace-deprecation ...` to show where the warning was created)
(node:22848) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option.

My environment

  • create-react-app 5.0.0
  • node 16.13.1
  • Windows 10

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:73
  • Comments:16

github_iconTop GitHub Comments

30reactions
holub008commented, Jan 26, 2022
  1. This is just a deprecation warning. Nothing is currently broken. Rolling back to react-scripts@4 is unnecessary at this point and likely not a good idea.
  2. The PR linked above (#11862) should fix the underlying issue (using deprecated webpack API). When that PR is released (looks like it will be in 5.0.1), update react-scripts to that version. No more warning, and you’re future-proofed!
11reactions
sbaggottcommented, May 17, 2022
  1. This is just a deprecation warning. Nothing is currently broken. Rolling back to react-scripts@4 is unnecessary at this point and likely not a good idea.
  2. The PR linked above (fix(webpackDevServer): fix deprecation warning #11862) should fix the underlying issue (using deprecated webpack API). When that PR is released (looks like it will be in 5.0.1), update react-scripts to that version. No more warning, and you’re future-proofed!

Actually, this breaks our app locally. It’s not just acting as a warning it’s acting as an error and preventing the dev server from running. We are using react-scripts 5.0.1 and the fix is still not implemented in that version. @holub008 any idea when 5.0.2 will be released?

Read more comments on GitHub >

github_iconTop Results From Across the Web

'onAfterSetupMiddleware' option is deprecated | bobbyhadz
To resolve the warning, update your configuration to use setupMiddlewares instead. dep webpack dev server on after setup middleware deprecationwarning. shell.
Read more >
Cant load a react app after starting server - Stack Overflow
This is a deprecation warning, meaning that you need to start using the newly suggested way of configuring your middleware.
Read more >
DevServer - webpack
DevServer. webpack-dev-server can be used to quickly develop an application. See the development guide to get started. This page describes the options that ......
Read more >
React Tutorial #0.4 onAfterSetupMiddleware is Deprecated
React Tutorial #0.4 onAfterSetupMiddleware is Deprecated | onBeforeSetupMiddleware is Deprecated | Dr Vipin ClassesIn this tutorial, ...
Read more >
onBeforeSetupMiddleware is Deprecated 문제 해결방법 - velog
(node:2584) DEP_WEBPACK_DEV_SERVER_ON_AFTER_SETUP_MIDDLEWARE DeprecationWarning: 'onAfterSetupMiddleware' option is deprecated. Please use ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found