I am making a react webpack application for artificial intelligence, specifically for natural language processing. First the error was generated that webpack could not read "node: fs/promises", this was corrected by adding the line: externalsPresets: { node: true }, but then this generated the error in the browser, after running the local server : Uncaught ReferenceError: require is not defined. The webpack build was successful, what is failing is the local server browser.
The specific error is: Uncaught ReferenceError: require is not defined at core-js-pure/features/global-this (global-this":1:1) at options.factory (react refresh:6:1) at webpack_require (bootstrap:24:1) at fn (hot module replacement:62:1) at ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js (ReactRefreshEntry.js:3:1) at options.factory (react refresh:6:1) at webpack_require (bootstrap:24:1) at startup:4:1 at startup:7:1
How could I solve this error from the webpack configuration or with any other alternative?