Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

395
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!