Next.js Discord

Discord Forum

getting a warning and navigation bar doesn't work.

Unanswered
Wuchang bream posted this in #help-forum
Open in Discord
Wuchang breamOP
(index):1 The resource https://annomy.vercel.app/_next/static/chunks/bcff58816fb0727e.css was preloaded using link preload but not used within a few seconds from the window's load event. Please make sure it has an appropriate `as` value and it is preloaded intentionally

I am using nextjs with tailwindcss. warning i'm getting ^
website: https://annomy.vercel.app
Navigation bar in mobile view doesn't work.
GlobalScripts.js:
export default function GlobalScripts() {
    const initialized = useRef(false);
    console.log("GLOBAL SCRIPTZ")
    
    useEffect(() => {
        if (initialized.current) return;
        initialized.current = true;
        
        function init() {
            const openMenu = document.getElementById("open_menu");
            if (openMenu) {
                if (Toggler) {
                    const toggler = new Toggler();
                    console.log(1)
                    openMenu.onclick = () => {
                        toggler.toggleSlide("menu", "right", 0.5);
                        toggler.toggleClass("open_text", "fa-bars", "fa-xmark");
                    };
                    console.log("HI")
                } else {
                    openMenu.onclick = () => {
                        const menu = document.getElementById("menu");
                        const icon = document.getElementById("open_text");
                        if (menu) {
                            if (menu.style.display === "none" || !menu.style.display) {
                                menu.style.display = "flex";
                                icon?.classList.replace("fa-bars", "fa-xmark");
                            } else {
                                menu.style.display = "none";
                                icon?.classList.replace("fa-xmark", "fa-bars");
                            }
                        }
                    };
                }
            }

console.log("GLOBAL SCRIPTZ")
Even I don't see this

1 Reply

Wuchang breamOP
And the main thing is, It WORKS in localhost, but only NOT in vercel's production.