D
D
Denis Bukreev2017-10-20 23:13:39
JavaScript
Denis Bukreev, 2017-10-20 23:13:39

What to do with a regular jquery plugin connected via npm?

There is a classic jquery plugin that you connect to your main scripts, and before it you also connect jquery and call it $().plugin();
. That's just not a task - using the module system, this method is inconvenient (extra requests for jquery and the plugin, and indeed jquery is already tightly embedded from npm in each module) and the plugin was added to the npm library.
And what to do with it now?
I import it: import 'plugin-jquery', but the scripts do not react much and cause an error that there is no such function ( $().plugin is not a function).
How to connect it then?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
H
hakkol, 2017-10-21
@hakkol

Installed jquery and suggestions-jquery via npm, wrote in the js file:

var $ = require('jquery');
require('suggestions-jquery');

$('.js-class').suggestions();

There are no errors. Through inport everything works too.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question