HubSpot / messenger

Growl-style alerts and messages for your app. #hubspot-open-source
http://github.hubspot.com/messenger/
MIT License
4.03k stars 408 forks source link

Can't "import" or "require" messenger with JS #120

Open akarelas opened 7 years ago

akarelas commented 7 years ago

Please do what you must, so that I can do:

let Messenger = require('messenger');

or...

import Messenger from 'messenger';

akarelas commented 7 years ago

I.e. please make it play nicely with Webpack

rzb commented 7 years ago

+1 @akarelas did you find a solution?

akarelas commented 7 years ago

No

rzb commented 7 years ago

I just made it work like this:

require('messenger/build/js/messenger');

dragg commented 7 years ago

@akarelas You can import it because inside the lib we haven't any export and the lib work with the global window object. You only can do like: import 'messenger/build/js/messenger';

gregveres commented 6 years ago

If the npm package.json included a main tag like this: "main": "build/js/messenger.js",

then it would work better and it could be imported like this:

import 'messenger-hubspot';

(I am going off of the npm package called messenger-hubspot.

vesper8 commented 6 years ago

I can confirm this works after installing from npm

import 'messenger-hubspot/build/js/messenger';