Syntax Error: Import Declarations May Only Appear at Top Level of a Module

I am trying to use a plugin called “Simplebar” found on GitHub, GitHub SimpleBar but after downloading the scripts and looking at the simple.js script, it looks like it has an error “SyntaxError: import declarations may only appear at top level of a module”

At the top of the simplebar.js file there are some import lines of code:

import scrollbarWidth from 'scrollbarwidth'
import debounce from 'lodash.debounce'
 
import './simplebar.css'

Leave a Comment