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

Usage with ES6 style imports #12

Open
cyorobert opened this issue Jan 5, 2017 · 6 comments
Open

Usage with ES6 style imports #12

cyorobert opened this issue Jan 5, 2017 · 6 comments
Assignees
Milestone

Comments

@cyorobert
Copy link

cyorobert commented Jan 5, 2017

Hey, thanks for the hard work - the library is great! When I try to use the library with ES6 imports like below

import wdtEmojiBundle from "wdt-emoji-bundle";

function addEmoji(){
    wdtEmojiBundle.init('.my-selector');
}

I get the error Uncaught ReferenceError: EmojiConvertor is not defined. I'm assuming this is because I haven't imported emoji.min.js, but why wouldn't the bundle import that module itself? Why do we need to create an extra global definition for that object?

In order to use the library I had to do the following:

import EmojiConvertor from "./../../../node_modules/wdt-emoji-bundle/emoji.min";
window.EmojiConvertor = EmojiConvertor;
import wdtEmojiBundle from "wdt-emoji-bundle";

function addEmoji(){
    wdtEmojiBundle.init('.my-selector');
}
@needim
Copy link
Owner

needim commented Jan 6, 2017

Hi @cyorobert, I guess I forgot to declare the dependency on wrapper.

I will check, thanks.

@needim needim self-assigned this Jan 6, 2017
@cyorobert
Copy link
Author

Excellent @needim thank you!

@needim needim added this to the v0.2.0 milestone Mar 31, 2017
@needim needim closed this as completed Mar 31, 2017
@DaveSanders
Copy link

I'm having a similar, but different problem with ES6. (v0.2.0)

import wdtEmojiBundle from 'wdt-emoji-bundle'

results in:

Error: Can't resolve 'js-emoji'

@DaveSanders
Copy link

Disregard - this looks to be an issue with a emoji js required package that is not compatible with webpack 3.

@DaveSanders
Copy link

Ok, now looking at it further, if I install wdt-emoji via NPM, my webpack complains:

This dependency was not found:
* js-emoji in ./node_modules/wdt-emoji-bundle/wdt-emoji-bundle.js
To install it, you can run: npm install --save js-emoji

The problem is that js-emoji npm doesn't exist. Maybe they've renamed it, because on their git, they refer to their package as 'emoji-js'. I install that, and then have to change the references in the wdt-emoji js to compensate.
Don't know if this is correct, of if I'm stabbing in the dark here.

@Pela647
Copy link

Pela647 commented Nov 5, 2018

@DaveSanders were you able to solve the above issue, i am having similar problem?

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

4 participants