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

388
Vistas
Swiper 8 with Webpack 5: Class not defined

I'm trying to use Swiper 8 with Webpack 5.

In my Webpack config i defined two entry points:

module.exports = {
    entry: {
        vendor: './vendor.js',
        frontend: './frontend.js',
    }
    ...
}

In the vendor.js I've imported Swiper:

import 'swiper/scss';
import Swiper from 'swiper';

In the frontend.js I've imported my script files:

import './custom.js'

No i try to initalize Swiper in my custom.js:

const swiper = new Swiper('.swiper', {});

Here I get an error message:

Uncaught ReferenceError: Swiper is not defined

In my HTML file, I import the vendor.js before the frontend.js file. Theoretically, the Swiper class should be available to me. What am I doing wrong?

<script type="text/javascript" src="/dist/vendor.js"></script>
<script type="text/javascript" src="/dist/frontend.js"></script>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You will need to

import Swiper from 'swiper';

inside your custom.js, because, even though it is properly imported in frontend.js, it's not imported in custom.js and it is not seen there.

about 4 years ago · Juan Pablo Isaza Denunciar
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