Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

188
Vistas
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
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda