Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

4.4K
Views
Cant load a react app after starting server

(node:13176) [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:13176) [DEP_WEBPACK_DEV_SERVER_ON_BEFORE_SETUP_MIDDLEWARE] DeprecationWarning: 'onBeforeSetupMiddleware' option is deprecated. Please use the 'setupMiddlewares' option

React is loading continuously after starting server

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

This is a deprecation warning, meaning that you need to start using the newly suggested way of configuring your middleware. Instead of onBeforeSetupMiddleware and onAfterSetupMiddleware, use the setupMiddlewares-property.

The documentation itself can be found on Webpack's website (in this case here: https://webpack.js.org/configuration/dev-server/#devserversetupmiddlewares)

The configuration will look something like this (coming from onBeforeSetupMiddleware and onAfterSetupMiddleware):

setupMiddlewares: (middlewares, devServer) => {
    middleware1(devServer.app)
    middleware2(devServer.app)

    return middlewares
},

Another useful way of fixing this issue is by looking at the code others have written to fix this issue. I found this example to be helpful: https://github.com/facebook/docusaurus/pull/6168

over 4 years ago · Santiago Trujillo Report

0

I had the same issue. The problem was with the setupProxy.js.

If your setupProxy.js files look like below

const proxy = require('http-proxy-middleware');

module.exports = function(app) {
  app.use(proxy('/proxypath', { target: '<target path>' }));
};

Change it as below

const { createProxyMiddleware } = require('http-proxy-middleware');

module.exports = function(app) {
  app.use(createProxyMiddleware('/proxypath', { target: '<target path>' }));
};

As in the error, you have quoted, onAfterSetupMiddleware and onBeforeSetupMiddleware have been deprecated therefore the proxy method is not working as expected. So when you start the server with npm start the browser tries to redirect to the proxy URL. That's why you see as the react app is not loading.

over 4 years ago · Santiago Trujillo Report

0

It's just a deprecation warning from one of the libraries you used within the app, have you tried to open http://localhost:3000 on your local? it is supposed to be running fine

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!