-2

Hello,

I've been developing a page with glide.js in WordPress. After I've included the needed JS Files in functions.php, I have seen that in my console it says "Uncaught ReferenceError: require is not defined." What can I do to make the site that works on the client/side browser either? Here is the main.js file's code.

Thanks in advance,

document.addEventListener("DOMContentLoaded", () => {
new Glide(".glide", {
    type: "carousel",
    startAt: 0,
    animationTimingFunc: "ease-in-out",
    gap: 100,
    perView: 3
}).mount();
});

EDIT: And the glide.min.js file's code starts like this-->

const { Alert } = require("bootstrap");

console ss

functions.php ss

  • 1
    The code you have shared with us doesn't use `require`. It isn't the cause of the error. – Quentin Jul 14 '21 at 13:38
  • Please use code blocks for all of your files, don't use images. Images cannot be indexed as text by search engines and make it harder for people to read/quote your question, and overall help you. You can read more about how to do so in the help section: [How do I format my posts using Markdown or HTML?](https://stackoverflow.com/help/formatting). Also read [How to create a Minimal, Reproducible Example](https://stackoverflow.com/help/minimal-reproducible-example). You use some "magic functions" from libraries/frameworks that make it impossible to reproduce it without knowing this context. – gomes Jul 14 '21 at 14:05
  • Dupklicate of [Javascript require() function giving ReferenceError: require is not defined](https://stackoverflow.com/questions/23603514/javascript-require-function-giving-referenceerror-require-is-not-defined) – esqew Jul 14 '21 at 14:29
  • Hello, I've updated the part that includes "require". I didn't want to type all the code of glide.min.js because It is too long and a typical function code that belongs to glide.min.js – Batuhan Keskin Jul 14 '21 at 14:30

1 Answers1

0

Once I tried to implement the require.js to my project, It gave me another error in the console.

["Uncaught Error: Mismatched anonymous define() module: etc."]

require.js