Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

140
Vistas
Webpack removes JavaScript in production mode

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.

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda