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

398
Vistas
swiperjs Uncaught SyntaxError: Cannot use import statement outside a module

I am trying to use swiper from swiperjs.com on my website. I installed node and added swiper as a dependency with the npm install swiper command. I created a swiper.js file where I am trying to import swiper:

import Swiper from "swiper";
const swiper = new Swiper(".swiper");

In the head of my HTML I added this line to load the swiper.js file:

<script type="text/javascript" src="http://localhost:8000/js/swiper.js"></script>

This is my package.json file:

{
  "name": "sasstheme",
  "version": "1.0.0",
  "scripts": {
    "watch": "sass --watch src/scss/style.scss style.css"
  },
  "devDependencies": {
    "sass": "^1.49.9"
  },
  "dependencies": {
    "swiper": "^8.0.7"
  }
}

When I load the page I am getting the following error in the console:

Uncaught SyntaxError: Cannot use import statement outside a module
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