// module.js
module.exports = {
m1() {
console.log('m1')
},
m2() {
this.m1()
console.log('m2')
}
}
// index.js
const { m2 } = require('./module')
m2()
When I try to access a method from another in a module object, it gives the following error: TypeError: this.m1 is not a function
. I have tried this on a normal object dozen of times yet never seen an error like that. Is this an error special to the module
object? If so, how can I solve this problem?