How to access require, from an HTML file, when contextIsolation is set to true

I’m trying to get electron into this HTML file, but require is undefined:

<script>
    const electron = require("electron");
    const {icpRenderer} = electron;

    const form = document.querySelector("form");
    form.addEventListener("submit", submitForm);

    function submitForm(e){
        e.preventDefault();
        const item = document.querySelector("#item").value;
    }
</script>

I have nodeIntegration as True, and contextIsolation as True for the web preferences which is used to prevent security warnings. How can I get require through this file?