Javascript Import in routes/home.js

I need to use a javascript library only on the homepage. I saw there is a routes/home.js in the assets folder.
I’m trying to import a library in home.js however whenever I do, it says 5:9 error Parsing error: 'import' and 'export' may only appear at the top level

If i put the import in main.js it says 5:8 error 'Chart' is defined but never used no-unused-vars

How do i import this and do stuff only on the homepage?

That message means you’re using your import statement not at the top of your home.js file.
Put it up top and it will work.

Ayy I thought it was something easy like that! Thanks for the reply, I really appreciate it!