javascriptwebpackemojione

How to use emojionearea library in webpack


I try to using emojionearea with jquery in webpack like

import $ from 'jquery'
import emojione from 'emojione'

$('.class').emojioneArea({... })

I tested Jquery working well But when using emojioneArea that has error like

Uncaught TypeError: jquery__WEBPACK_IMPORTED_MODULE_1___default(...)(...).emojioneArea is not a function

How to make that working, thanks.


Solution

  • According to the document, it looks like you import the wrong package name. It's supposed to be emojionearea instead of emojione. I think you also need to expose jquery in the global for other plugins too as following:

    import $ from "jquery"
    import 'emojionearea';
    
    global.$ = global.jQuery = $;
    
    $('.class').emojioneArea({ ... })