Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

396
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda