Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

181
Views
browserify not working on basic html and basic js

I'm trying to create an simple web page to test the crypto module in js, but even when i use browserify my brower returns Uncaught ReferenceError: require is not defined.

My script.js:

const { createHash } = require('crypto');


function hasher() {
    const password = document.getElementById("js_n_password").value;
    const hash = createHash(password);
    document.getElementById("hashed").innerHTML = password;
}

My index.html:

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" href="style.css">
        <script src="bundle.js"></script>
        <script src="script.js"></script>
    </head>
    <body>


        <h1>Web Hash</h1>
        <form class="input" id="input">
            <label for="n_password">Password:</label>
            <input type="password" id="js_n_password" name="n_password">
        </form> 
        <button onclick="hasher()">hash it</button> 

        <p class="hashed" id="hashed"> </p>

    </body>
</html>

Why browserify isn't working and how can i make it work?

PS: add module.exports = function (n) { return n * 111 } to script.js doesn't change anything.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!