davinkevin / AngularStompDK

Angular service to communicate to Stomp-Websocket
http://davinkevin.github.io/AngularStompDK/
Apache License 2.0
36 stars 12 forks source link

webpack support #53

Open kleinph opened 7 years ago

kleinph commented 7 years ago

If I try to import AngularStompDK with import AngularStompDK from 'AngularStompDK';, I get the following error message:

Uncaught Error: Cannot find module "."
    at webpackMissingModule (angular-stomp.min.js:1)
    at angular-stomp.min.js:1
    at Object.<anonymous> (angular-stomp.min.js:1)
    at Object.module.exports.import (angular-stomp.min.js:2)
    at __webpack_require__ (bootstrap 319d65adb53f8f2ff734:54)
    at Object.h (index.js:1)
    at __webpack_require__ (bootstrap 319d65adb53f8f2ff734:54)
    at Object.<anonymous> (shot.module.js:3)
    at __webpack_require__ (bootstrap 319d65adb53f8f2ff734:54)
    at Object.<anonymous> (main.bundle.js?319d65adb53f8f2ff734:107)

If I try it with the ES 2015 module (import ngStomp from 'AngularStompDK/core/ngStomp';), I get:

libs.bundle.js?73ff7fcae564d1fff95c:128584 Uncaught Error: Cannot find module "stompjs"
    at Object.<anonymous> (libs.bundle.js?73ff7fcae564d1fff95c:128584)
    at __webpack_require__ (bootstrap 73ff7fcae564d1fff95c:54)
    at Object.<anonymous> (shot.module.js:3)
    at __webpack_require__ (bootstrap 73ff7fcae564d1fff95c:54)
    at Object.<anonymous> (main.bundle.js?73ff7fcae564d1fff95c:107)
    at __webpack_require__ (bootstrap 73ff7fcae564d1fff95c:54)
    at Object.Array.concat.map../log (main.bundle.js?73ff7fcae564d1fff95c:6)
    at __webpack_require__ (bootstrap 73ff7fcae564d1fff95c:54)
    at webpackJsonpCallback (bootstrap 73ff7fcae564d1fff95c:25)
    at main.bundle.js?73ff7fcae564d1fff95c:1

So is it possible to also add support for Webpack?

davinkevin commented 7 years ago

I'm really interested to add Webpack support... but I don't work a lot with it, so I will have to discover everything about it to find the origin of the problem.

But, if you know more, you can try to use a fork version of the lib with some modification to see if it works better and then do a PR.

The error message seems to be about the default import used in the lib. Maybe using a named import could work.

Thanks for your help

chetbis commented 6 years ago

Same here

davinkevin commented 6 years ago

@chetbis and @kleinph : Could you test to fork the project and try to change the default import in order to see if this is the origin of the fix.

I don't have any project with this setup (webpack & co), so I can't reproduce the problem... if you can provide an empty project with your config to help me reproduce the bug, it would help...

Thanks