olofd / react-native-signalr

Use SignalR with React Native
150 stars 61 forks source link

Compatibility with Webpack 2.2.0 #20

Closed pardahlman closed 7 years ago

pardahlman commented 7 years ago

Hej!

First of, great work with this lib 👌 . I can wait until Microsoft releases their re-take on SignalR, so that we finally can get rid of the jQuery dependency altogether. Until then, I thought I'd try out this neat workaround.

The project I'm currently working on uses the latest version of Webpack (2.2.1). I get the following error when trying to import from the module

> Uncaught TypeError: Cannot assign to read only property 'exports' of object '#<Object>'

It looks like the same problems reported over at webpack's repo. In short it looks like module.exports is readonly when using ES2015 modules.

Do you have any plans for making this package compatible with contemporary modules?

Keep up the good work!

pardahlman commented 7 years ago

I found a package that uses your jQuery shims to achieve the same goal: signalr-no-jquery. Webpack 2.2 and my .babelrc didn't complain, so I have a viable workaround!

olofd commented 7 years ago

@pardahlman : FYI That is a fork of this library and does not include some of the latest bugfixes.

olofd commented 7 years ago

Try installing version 1.0.1 and see if that works.

jp928 commented 7 years ago

In my case, the version 1.0.1 cases the ms-singlar-library cannot find jquery library anymore. Please test it.

pardahlman commented 7 years ago

@olofd thanks for the update. I'll give it a go later this week and report back!

pardahlman commented 7 years ago

As a side note, I cloned your source code and changed module.export to default export, but chrome complained about changing read-only props on window. I didn't investigate further, but I'll post the actual error if it occurs under 1.0.1. (The problem could be the way I built the lib, what's your build process like?)

olofd commented 7 years ago

There is a problem with 1.0.1. FIxing it now. 1.0.2 out in 10min.

olofd commented 7 years ago

Fixed. Install version 1.0.2 and try it out. Worked here.

olofd commented 7 years ago

@perkola When you have the time to test, and if it works, please close this issue.

perkola commented 7 years ago

@olofd sorry I have not used this package with Webpack for some time. I am not sure how involved I am.

olofd commented 7 years ago

haha so sry @perkola. Githubs auto-complete gave me you! Of course I meant @pardahlman . Hope everything's well at least @perkola !

perkola commented 7 years ago

Haha yeah I figured after reading the full discussion. Thank you! All is well :smiley:

olofd commented 7 years ago

Closing after no replay from @pardahlman