why js file not working in Astro when I import or add src in Astro file?
ex: <script src="../scripts/local.js"></script>
or <script>import '../scripts/local.js'</script>
I'm working on a local environment and I'm sure I've written my src URl correctly but my functions aren't working. this is my written js code
const navLinks = document.querySelectorAll("[data-navLink]");
navLinks.forEach((link) => {
if (link.getAttribute("href") === window.location.pathname) {
link.setAttribute("aria-current", "page");
console.log(window.location.pathname);
}
});