-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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
Use of deprecated webpack DevServer onBeforeSetupMiddleware and onAfterSetupMiddleware options #11860
Comments
Any update? |
Looks like there's a PR open for this now: #11862 |
any idea on how to fix this ? |
Still having this issue. (with node 16.13.2) |
|
Is there a workaround that can be done with craco or something until it's fixed? Just trying to reduce false errors so that I can spot real issues earlier. Thanks a lot. |
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. |
i had the same problem, i just changed the react-scripts from package.json to version 5.0.0. For hte moment it works |
@sbaggott I'm not a maintainer, just an interested party. It does seem as though this is impacting a large number of users; Even more so if it's crashing the dev server (it was not crashing mine in 5.0.0, FWIW). |
It looks like the crashing of the app was not related. I had to blow away
my node_modules a couple times and restart, but finally got it to stop
crashing.
…On Wed, May 18, 2022 at 4:08 PM Karl Holub ***@***.***> wrote:
@sbaggott <https://github.com/sbaggott> I'm not a maintainer, just an
interested party. It does seem as though this is impacting a large number
of users; Even more so if it's crashing the dev server (it was not crashing
mine inn 5.0.0, FWIW).
—
Reply to this email directly, view it on GitHub
<#11860 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAEA34AWBPQER5476HCCKRTVKVZ5HANCNFSM5LA33DSQ>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Nonetheless, warnings like this can set you on wild goose hunts. Or worse,
make you think most warnings can safely be ignored.
…On Mon, May 23, 2022, 21:47 Sage Baggott ***@***.***> wrote:
It looks like the crashing of the app was not related. I had to blow away
my node_modules a couple times and restart, but finally got it to stop
crashing.
On Wed, May 18, 2022 at 4:08 PM Karl Holub ***@***.***> wrote:
> @sbaggott <https://github.com/sbaggott> I'm not a maintainer, just an
> interested party. It does seem as though this is impacting a large number
> of users; Even more so if it's crashing the dev server (it was not
crashing
> mine inn 5.0.0, FWIW).
>
> —
> Reply to this email directly, view it on GitHub
> <
#11860 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AAEA34AWBPQER5476HCCKRTVKVZ5HANCNFSM5LA33DSQ
>
> .
> You are receiving this because you were mentioned.Message ID:
> ***@***.***>
>
—
Reply to this email directly, view it on GitHub
<#11860 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAJ2QDRZZTANMCBQGIDXYYDVLPOGVANCNFSM5LA33DSQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
CRACO SolutionFor anyone using CRACO and is trying to override the devServer config, in order to resolve the DeprecationWarning, here is the solution. import fs from "fs";
import NodePolyfillPlugin from "node-polyfill-webpack-plugin";
import evalSourceMap from "react-dev-utils/evalSourceMapMiddleware";
import redirectServedPath from "react-dev-utils/redirectServedPathMiddleware";
import noopServiceWorker from "react-dev-utils/noopServiceWorkerMiddleware";
import type { CracoConfig } from "@craco/craco";
const config: CracoConfig = {
webpack: {
plugins: {
add: [
new NodePolyfillPlugin({
excludeAliases: ["console"],
}),
] /* An array of plugins */,
},
},
devServer: (devServerConfig, { env, paths }) => {
devServerConfig = {
onBeforeSetupMiddleware: undefined,
onAfterSetupMiddleware: undefined,
setupMiddlewares: (middlewares, devServer) => {
if (!devServer) {
throw new Error("webpack-dev-server is not defined");
}
if (fs.existsSync(paths.proxySetup)) {
require(paths.proxySetup)(devServer.app);
}
middlewares.push(
evalSourceMap(devServer),
redirectServedPath(paths.publicUrlOrPath),
noopServiceWorker(paths.publicUrlOrPath)
);
return middlewares;
},
};
return devServerConfig;
},
};
export default config; I hope this helps someone. Happy hacking : ) |
The solution found here - https://stackoverflow.com/questions/70469717/cant-load-a-react-app-after-starting-server Updating from
to
Has fixed this for me |
Upgrade to npx create-react-app@5.0.1 my-app |
What do you mean by PR |
@pankajuprety PR is short for “Pull Request”. GitHub has pretty extensive documentation about PRs in https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/about-pull-requests. |
hey,
},
}` change to `setupMiddlewares: (middlewares, devServer) => {
}` |
It is not advised to change files in the node_modules folder as @26haroon26 suggests above. Any changes there will be destroyed once dependencies are installed which should be happening on a production build or CI to ensure your deps are "clean". If and I stress if there is a need to update node_modules dependencies then the safer solution is to use patch-package. But this should be as limited as possible and when no other solution is possible, the better and longer term solution is to either open a PR with the changes or jump over to an existing PR and subscribe to it to get updates when it is merged. In this case I do not believe patching the package is necessary, and there is already an open PR #11862 to fix this, and since it is only a deprecation warning it can probably be ignored until it is merged. |
|
Have this craco config that I'm trying to override the current proxy problem. But It don't seems to be working. Anyone have a suggestion why it's not co-operating as intended? Thx :)
|
Any updates Solutions for this? Options
|
Any updates? |
https://github.com/babel/babel-plugin-proposal-private-property-in-object is showing the following message, so if it is true that "the create-react-app project ... is not maintianed (sic) anymore", then it would be helpful if this statement appeared explicitly in this repository's README to avoid having to "read between the lines"!
|
This is really bad, I am facing issue during our deployment phase. We have developed our app and when trying to deploy on azure, where its treating these warnings as error and the project is not working. Its failing to start. If create-react-app is not maintained, then it should be mentioned in the documentation so people don't end up stuck in the middle. |
@rathorer Unfortunately, the project is not only unmaintained, but has been completely abandoned. There's no other choice right now than to migrate to another tool. |
|
I opened this issue in Dec 2021. FYI I've since migrated my SPA to Next.js using an approach like https://nextjs.org/docs/app/building-your-application/upgrading/from-vite. Vite also looked like a good option, but I had other non-SPA projects using Next, so decided to standardise on it. Everything is going well, and the DX is far superior to CRA. Full disclosure: there is one key issue I'm currently working around: vercel/next.js#56636. |
If anyone has react scripts silently failing with no errors, I did a reverse of this suggestion when migrating from react-scripts 4.0.3 to 5.0.1 and it worked! Just swap "to" and "from". |
Steps to reproduce
Unexpected output
My environment
The text was updated successfully, but these errors were encountered: