title: Why am I getting "TypeError: Assignment to constant variable" when trying to import my function?
body: <p>I am trying to import my function from <code>utils/login.js</code> file, in my <code>login.js</code> file I have this.</p>
  
  <pre><code>login = (usern, passw) =&gt; {
    try {
      // do something
    } catch (error) {
      return(error)
    }
  };
  
  module.exports.login;
  </code></pre>
  
  <p>I also have a <code>utils/index.js</code> file with this in</p>
  
  <pre><code>module.exports = {
      login: require("./login")
  }
  </code></pre>
  
  <p>when I run <code>const {login} = require("./utils")</code> from the terminal I get this error but I'm not sure how to resolve it</p>
  
  <p><code>TypeError: Assignment to constant variable.</code></p>