Import JQuery plugin using Webpack

Viewed 38

Using Webpack I have in my entry point file the following:

import * as $ from 'jquery';

require('./redactor.js');

window.jQuery = $;

if (typeof jQuery === 'undefined') {
  alert("JQuery Not Found");
} else {
  alert("JQuery OK");
}

$(function () { 

  $("textarea.editor").redactor();  

});

JQuery is working but I get an error when trying to use Redactor:

jQuery.Deferred exception: jquery__WEBPACK_IMPORTED_MODULE_6__("textarea.editor").redactor is not a function. (In 'jquery__WEBPACK_IMPORTED_MODULE_6__("textarea.editor").redactor()', 'jquery__WEBPACK_IMPORTED_MODULE_6__("textarea.editor").redactor' is undefined) 

The JQuery plugin 'Redactor' is in the same folder of index.js.

How can I solve this?

0 Answers
Related