swr icon indicating copy to clipboard operation
swr copied to clipboard

App is crashed in dev mode: Value undefined out of range for undefined options property undefined

Open alexander-lebed opened this issue 2 years ago • 2 comments

The app is crashed on opening any page in dev mode, (prod runs OK). The error is thrown from version 1.2.0

RangeError: Value undefined out of range for undefined options property undefined
    at Map.set (<anonymous>)
    at AsyncHook.init (node:domain:76:15)
    at emitInitNative (node:internal/async_hooks:205:43)
    at emitInitScript (node:internal/async_hooks:495:3)
    at promiseInitHook (node:internal/async_hooks:325:3)
    at promiseInitHookWithDestroyTracking (node:internal/async_hooks:329:3)
    at Promise.then (<anonymous>)
    at Promise.promise.<computed> (D:\STUFF\WORK\workspace\wincher\frontend\packages\app\.next\server\webpack-runtime.js:108:30)
    at D:\STUFF\WORK\workspace\wincher\frontend\packages\app\.next\server\webpack-runtime.js:96:52
    at Array.map (<anonymous>)

Maybe I'm missing something. The issue occurs after install new swr version or even when I updated all the usages according to https://swr.vercel.app/blog/swr-v1

swr: 1.2.2 next: 12.1.0 react: 17.0.2 node: 16.13.0

Workaround

Install swr 1.1.2 or less

alexander-lebed avatar Mar 23 '22 08:03 alexander-lebed

It seems that there're too many items created: https://github.com/nodejs/node/issues/37320? Would be great if you can provide a minimal reproduction for us to take a look.

shuding avatar Apr 03 '22 13:04 shuding

I have also the same problem when compiling over 2000 modules.

When I cut components tree of my app below 2000 modules, compiling in developer mode is working fine.

My app have over 4500 modules.

I does not depend on swr version.

SUCHiDEV avatar Apr 26 '22 10:04 SUCHiDEV

I think @SUCHiDEV is right, it's not related to SWR. Can be fixed by

experimental: {
  esmExternals: false,
}

from here

alexander-lebed avatar Aug 30 '22 13:08 alexander-lebed