Using NPM Bootstrap Tokenfield in Ember


I have an Ember.js application where I installed bootstrap-tokenfield with npm.

I then installed ember-browserify so I do

import BootstrapTokenfield from "npm:bootstrap-tokenfield";

to import the plugin.

How do I know what the ? in import ? from npm:bootstrap-tokenfield should be?

The way we generally use the plugin is like


Looking at the ES6 references, ? is usually a module that is used directly, but in this case it looks like it is an attribute of the selector result?

Also looking at the package.json for bootstrap-tokenfield, I don’t see jquery-ui included as a dependency but is needed for autocomplete.

What is the best practice for including jquery UI as part of the import?


If this is a mandatory dependency, best practice would be to tell the package owner to fix his plugin definition. Probably by opening an issue on github. But maybe it is an optional dependency, in that case, you should just add it to your own dependencies.

In your example, this is a jquery plugin, so it adds itself to jquery’s API, that’s why you find it there. You could either look if it also supports ES6 modules, or otherwise just list it in your devDependencies and use it as $('.foo').tokenfield()