Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
akarelas opened this issue Dec 30, 2016 · 7 comments
Open

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

akarelas opened this issue Dec 30, 2016 · 7 comments

Comments

@akarelas
Copy link

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

let Messenger = require('messenger');

or...

import Messenger from 'messenger';

@akarelas
Copy link
Author

I.e. please make it play nicely with Webpack

@rzb
Copy link

rzb commented Mar 6, 2017

+1
@akarelas did you find a solution?

@akarelas
Copy link
Author

akarelas commented Mar 6, 2017

No

@rzb
Copy link

rzb commented Mar 6, 2017

I just made it work like this:

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

@dragg
Copy link

dragg commented Mar 29, 2017

@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
Copy link

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
Copy link

vesper8 commented Jul 2, 2018

I can confirm this works after installing from npm

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants