I'm not sure, if my question is that correct. I'm quite new in working with webpack. Normally I add every dependency via npm and it is working fine. Now I tried to add bootstrap-5-autocomplete from GitHub, where is no npm i option.
therefore I created a new js file and do import "./modules/bootstrap-5-autocomplete"; in my main.js file, which is the entry point in my webpack configuration. Build progress works fine without no errors. Online I call the script via
const ac = new Autocomplete(
document.getElementById('verein'),
{
data: datasrc,
treshold: 1,
maximumItems: 8,
onSelectItem: ({label, value}) => {
console.log("user selected:", label, value);
}
}
);
but console shows Autocomplete is not defined. On searching in my js build there is no autocomplete. When I add $("#test").remove() between the lines of the autocomplete script, I'm able to find only these lines, but everything else from the script is not generated in my build file. Only in development mode, I can find the lines but its still not working with same error, autocomplete is not defined.
In the webpack environment, Visual Code does also a warning, that Class Autocomplete is not defined. Without webpack, I don't get this message. What am I doing wrong in including third party js in webpack? When I load the script by itself via <script></script> in my html it works fine and I get no errors. I really appreciate your help.