Next.js: Uncaught TypeError: Cannot read property 'forEach' of undefined at Object.injectIntoGlobalHook

Created on 19 Oct 2020  路  3Comments  路  Source: vercel/next.js

Hi There,
I'm working with Electron and Next.js, but from couple of days ago I see an error on the console.

https://github.com/vercel/next.js/blob/114de064325d06d80287836fa6b453c62014356c/packages/react-refresh-utils/runtime.ts#L14

image

module.exports = {
  webpack(params) {
    const config = { ...params };
    config.target = 'electron-renderer';

    config.module.exprContextCritical = false;

    config.devtool = false;

    config.plugins = config.plugins.filter(plugin => {
      return plugin.constructor.name !== 'UglifyJsPlugin';
    });

    if (config.resolve.alias) {
      delete config.resolve.alias.react;
      delete config.resolve.alias['react-dom'];
    }

    return config;
  }
};

Most helpful comment

Closing this, After investigating in react code found that the reason is the old version of the react-devtool.

https://github.com/facebook/react/blob/c59c3dfe554dafb64864f3bbcfff6ffe51f32275/packages/react-refresh/src/ReactFreshRuntime.js#L485

All 3 comments

Closing this, After investigating in react code found that the reason is the old version of the react-devtool.

https://github.com/facebook/react/blob/c59c3dfe554dafb64864f3bbcfff6ffe51f32275/packages/react-refresh/src/ReactFreshRuntime.js#L485

for me error was happening due to old extension in the chrome browser named React Developer tools by disabling it i was able to solve this error you could try the same or try installing latest react developer tool.

I have the same issue. There was no obvious reason why it started happening, because code has not have any updates. I tried to open a page in another browser and it worked as I expected. So I don't understand how it can happen this way, but I have it only in my Chrome v86.0.4240.198

Was this page helpful?
0 / 5 - 0 ratings

Related issues

timneutkens picture timneutkens  路  250Comments

Timer picture Timer  路  90Comments

nvartolomei picture nvartolomei  路  78Comments

ematipico picture ematipico  路  66Comments

robinvdvleuten picture robinvdvleuten  路  74Comments