Uncaught ReferenceError: require is not defined code example

Example 1: electron Uncaught ReferenceError: require is not defined at recorder.js:1

app.on('ready', () => {
    mainWindow = new BrowserWindow({
        webPreferences: {
            nodeIntegration: true
        }
    });
});

Example 2: Uncaught ReferenceError: $ is not defined

<script src="https://code.jquery.com/jquery-1.9.1.js"></script>
<script src="path-para-seu-script"></script>

Example 3: Uncaught ReferenceError: $ is not defined

You should put the references to the jquery scripts first.
<script src="jquery-3.5.1.js"></script>
<script type="text/javascript" src="script.js"></script>

Example 4: require is not defined

remove "type": "module" from package.json

Example 5: Uncaught ReferenceError: scrollOut is not defined

Uncaught ReferenceError: scrollOut is not defined

Tags: