react-refresh-webpack-plugin icon indicating copy to clipboard operation
react-refresh-webpack-plugin copied to clipboard

Module build failed

Open igorMIA opened this issue 1 year ago • 1 comments

After migrating from React 16 to React 18 and a hot reloader from react-hot-loader to react-refresh-webpack-plugin facing that issue when starting webpack:

ERROR in ./static/main.jsx
Module build failed (from ./node_modules/@pmmmwh/react-refresh-webpack-plugin/loader/index.js):
/app/node_modules/@pmmmwh/react-refresh-webpack-plugin/node_modules/locate-path/index.js:41
                } catch {
                        ^

SyntaxError: Unexpected token {
    at createScript (vm.js:80:10)
    at Object.runInThisContext (vm.js:139:10)
    at Module._compile (module.js:617:28)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Module.require (module.js:597:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/app/node_modules/@pmmmwh/react-refresh-webpack-plugin/node_modules/find-up/index.js:3:20)
 @ multi ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ReactRefreshEntry.js webpack-dev-server/client?https://dev.buzzfeed.io:17531 ./node_modules/@pmmmwh/react-refresh-webpack-plugin/client/ErrorOverlayEntry.js?sockProtocol=http ./static/main.jsx ./static/styles/main.scss main[3]

Maybe have any ideas? Thanks!

igorMIA avatar Dec 22 '22 15:12 igorMIA

Figured it out myself. The problem was with my ancient Node version(8). I updated to 10.3 with optional catch binding support which fixed the current problem. Could it make sense to add that requirement to the project description? image

igorMIA avatar Jan 02 '23 16:01 igorMIA