I have this class:
class Validations {
static required (value) {
// code...
}
static min (value, arg) {
// code...
}
static max (value, arg) {
// code...
}
}
module.exports = Validations;
In my Node.js back-end i require it like this:
const Validations = require('./Validations.js');
I need to use it in my Vue app as well, but when I use require()
, I get error:
Cannot assign to read only property 'exports' of object '#<Object>'
Is there any way to set Babel to transpile it into common JS module?