AngularStompDK icon indicating copy to clipboard operation
AngularStompDK copied to clipboard

webpack support

Open kleinph opened this issue 8 years ago • 3 comments

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?

kleinph avatar Aug 24 '17 10:08 kleinph

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

davinkevin avatar Aug 24 '17 13:08 davinkevin

Same here

chetbis avatar Apr 08 '18 17:04 chetbis

@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

davinkevin avatar Apr 09 '18 03:04 davinkevin