xcash / bootstrap-autocomplete

Bootstrap Autocomplete
MIT License
168 stars 71 forks source link

How to import into webpack build? #116

Open chrisribal opened 3 years ago

chrisribal commented 3 years ago

Hi, i wanted to use the library in my webpack project. Unfortunately i can't find a way to import the library in my project.

I installed the library using npm: npm install --save bootstrap-autocomplete

Then i tried to use the following js:

const jQuery = require('jquery');
const $ = jQuery;

import autoComplete from 'bootstrap-autocomplete';
$('.search-input').autoComplete(); // --> autoComplete ist not a function

I also tried unnamed imports or required imports, but still no luck.

Unfortunately i can't really figure out the module exports, because the main js file is minified.

What am i missing? Thank you!

xcash commented 3 years ago

I used it in a webpack environment import it as folowing:

import 'bootstrap-autocomplete/dist/latest/bootstrap-autocomplete';
xcash commented 3 years ago

Write something in the docs in release 3.0.0