'Is there a way to import into a module.exports object?
I'm trying to import a function into a module.exports object. My code is essentially something like this:
import generateHash from "../generateHash.mjs";
module.exports = {
password: generateHash(password),
};
However, I've been receiving the following error:
ERROR: Cannot use import statement outside a module
I've attempted other workarounds like using the require() syntax but to no avail.
Is there any way that I can get around this issue? Thanks in advance to everyone answering!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
