angular2-websocket icon indicating copy to clipboard operation
angular2-websocket copied to clipboard

Not working with angular 2.0.0

Open DannyGolhar opened this issue 9 years ago • 8 comments

DannyGolhar avatar Sep 26 '16 13:09 DannyGolhar

Can you elaborate?

bomberblue07 avatar Sep 26 '16 19:09 bomberblue07

Well, the current angular2-websocket.js is in AMD format. Angular 2 switched to UMD's, so it needs certain processing if not packed with a bundler. For example, I do my packaging by hand (poor man's webpack) and I have to manually edit the file to convert the require calls into a System.amdDefine.

schungx avatar Sep 27 '16 04:09 schungx

It works fine for me, but I use SystemJS. Can you submit a PR with the changes you need?

bomberblue07 avatar Sep 27 '16 14:09 bomberblue07

Yes, SystemJS can take AMD modules. That's why. Angular 2 has removed dependencies on SystemJS and should now, theoretically, work with any module loader. That's the reason behind the switch to UMD module format. Before beta, Angular 2 at a time was tied to SystemJS, so all their modules were standard SystemJS format. It worked fine because people at that time had no choice -- use SystemJS.

I suppose you should simply ask TypeScript to generate UMD modules and be done with it. That should make sure it works in a wide variety of module loaders.

Or separate different versions, such as angular2-websocket.amd.min.js, angular2-websocket.umd.min.js etc.

schungx avatar Sep 28 '16 05:09 schungx

I'm not the developer here, @afrad is. So he can step in here and comment on what he's willing to do, or you can submit a PR on what you want done instead of describing what you want done.

bomberblue07 avatar Sep 29 '16 17:09 bomberblue07

Didn't want to interrupt the discussion. @schungx all makes sense to me, could you please submit a pr?

afrad avatar Sep 29 '16 17:09 afrad

Sorry! Not very familiar with this Git thing...! Am a Windows kind of person.

Can you simply turn the module format in tsconfig.json to umd?

schungx avatar Sep 30 '16 02:09 schungx

@schungx You are forgiven for being new to Git. PR = pull request. Essentially, you can fork this repository, make the changes to it that you want to see, and submit a pull request to this repository to merge those changes in. If @afrad is cool with your changes, he'll merge them in.

bomberblue07 avatar Sep 30 '16 15:09 bomberblue07