Please describe the problem you are having in as much detail as possible:
I'm trying to run discord.js within React Native (0.54.1). Of course, RN has no support for native modules so I figure I would try to use the web builds instead. In theory, this should work. In practice, I encounter the following error:
3:23:57 PM: TypeError: calling Map constructor without new is invalid
This error is located at:
in App (at registerRootComponent.js:35)
in RootErrorBoundary (at registerRootComponent.js:34)
in ExpoRootComponent (at renderApplication.js:35)
in RCTView (at View.js:78)
in View (at AppContainer.js:102)
in RCTView (at View.js:78)
in View (at AppContainer.js:122)
in AppContainer (at renderApplication.js:34)
* discord.js:932:24 in Collection
* discord.js:16977:17 in Client
* App.js:8:19 in App
- node_modules/react-proxy/modules/createClassProxy.js:98:23 in <unknown>
- node_modules/react-proxy/modules/createClassProxy.js:96:6 in instantiate
- ... 19 more stack frames from framework internals
FYI here are the problem lines:
class Collection extends Map {
constructor(iterable) {
super(iterable);
...
and
this.users = new Collection();
So obviously something fishy is going on here, since this seems like valid JS to me. My guess is that it's a transpilation issue, in which case I'd just like advice on what I should do to make these two things play together. Can I make a web build myself that conforms to the ES version RN wants?
Include a reproducible code sample here, if possible:
@Nexuist babel transforms our es6 class Collection extends Map in such a way that Map is called without new. you'll have to maybe wrap the global map or something similar. this isn't a bug with d.js anyway
Please describe the problem you are having in as much detail as possible: I'm trying to run discord.js within React Native (0.54.1). Of course, RN has no support for native modules so I figure I would try to use the web builds instead. In theory, this should work. In practice, I encounter the following error:
FYI here are the problem lines:
and
So obviously something fishy is going on here, since this seems like valid JS to me. My guess is that it's a transpilation issue, in which case I'd just like advice on what I should do to make these two things play together. Can I make a web build myself that conforms to the ES version RN wants?
Include a reproducible code sample here, if possible:
Further details:
Thank you!