SyntaxError: import declarations may only appear at top level of a module

16 This question already has answers here: ES2015 import doesn’t work (even at top-level) in Firefox (8 answers) Closed 2 years ago.

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'

If I look in my browser debugger I see an error: “SyntaxError: import declarations may only appear at top level of a module”.

Has anyone tried to us this plugin.

Many thanks in advance for your time.

Leave a Comment

error code: 523