In a file called data.js, I have a big object array:
var arr = [ {prop1: value, prop2: value},...]
I\'d like to use this array into my Node.js
You can simply wrap your array in a function.
// myArray.js export default function iDoReturnAnArray() { return ['foo', 'bar', 'baz']; } // main.js import iDoReturnAnArray from './path/to/myArray'; const unwrappedArray = iDoReturnAnArray(); console.log(unwrappedArray); // ['foo', 'bar', 'baz']