ljharb / get-intrinsic

Get and robustly cache all JS language-level intrinsics at first require time.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Encountered error: Uncaught TypeError: (intermediate value)[Symbol.iterator] is not a function

wenjoy opened this issue · comments

'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined$1 : getProto(new Map()Symbol.iterator)

should this line be defended in case this Map is not primitive, i.e. user rewrite it?

If the user has done that, they’ve broken their environment. What is the scenario where you ran into this error?

I'm developing micro app, and the host has rewrite the Map. So my code which depends on [get-intrinsic] will broken although i has no need to use Map directly. IMHO, at least we should make sure it will not broke users code by catch possible error and console some message.

If you're rewriting Map, then it should be spec-compliant. Both es6-shim and core-js provide one, so I'm not sure why you'd need to invent your own.

If you're rewriting Map, then it should be spec-compliant. Both es6-shim and core-js provide one, so I'm not sure why you'd need to invent your own.

I didn't invent or rewriting Map, I'm developing micro app with Single-SPA. It's the host app who rewrite the Map. I have no idea why they rewrite it but my micro app have to solve this problem to live with host environment where the Map is not normal ES6 Map.

Hope I've explained it clearly.

What is the host app? Can you file a bug so they can fix it?

I got it. They should fix.

If the host app won’t or can’t fix it (i still don’t know what the host app is - can you answer that question?) then i could certainly work around it, but I’d need to know what it is first so i can test on it.

Thanks buddy. I think they should. I will talk with them to solve it. I don't think this lib need to work around it because a wrong Map will lead to a big disaster.

I'd like to close this issue.