I\'m using ES6 modules and am importing a variable from moduleA into moduleB:
moduleA
moduleB
//moduleA.js let a = 5; let b; export { a, b }; //m
You can use an object instead of variables, like this the reference doesn't change :
//moduleA.js let object = { a: 5, }; export { object }; //moduleB.js import { object } from './moduleA' object.a = 6; object.b = 1;