Skip to content

Conversation

@vladimir-tikhonov-nutrient

Running npm i && npm start within examples/react resulted in the following error:
Invalid options object. Dev Server has been initialized using an options object that does not match the API schema. options has an unknown property 'onAfterSetupMiddleware'

Seems like webpack-dev-server@5 is not compatible with react-scripts@5, so I've downgraded it and now everything works

@vladimir-tikhonov-nutrient vladimir-tikhonov-nutrient requested a review from a team September 18, 2025 16:28
@vladimir-tikhonov-nutrient vladimir-tikhonov-nutrient added the bug Something isn't working label Sep 18, 2025
Copy link
Contributor

@miguelcalderon miguelcalderon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Downgrading Webpack Dev Server will reintroduce several vulnerabilities. Can you try other solutions, like https://discuss.codecademy.com/t/react-app-error/779264/2, please?

We should eventually just remove the CRA example, this framework has long been abandoned.

@vladimir-tikhonov-nutrient
Copy link
Author

@miguelcalderon got it! I've fixed it using an AI-generated patch for the start script. Not ideal, but example works :)

Copy link
Contributor

@miguelcalderon miguelcalderon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may have a more standardized approach to achieve the same result, sorry not suggesting this before! 🙈


patchWebpackDevServerConfig();

require("react-scripts/scripts/start");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vladimir-tikhonov-nutrient we use patch-package in the monorepo to solve similar issues; do you think we could use it here as well?

@divyanshu013
Copy link
Member

I agree with Miguel, CRA is abandoned so I'm not sure if it'll receive all security updates. Perhaps we should just remove this example and default to vite which is recommended over CRA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants