below files are stored in imports
folder, i would like to extend A
in main.js
using multiple import files, and export it out
// main.js
A = {
a : 0
};
import './b.js'
import './c.js'
...
export default A;
// b.js
import A from './main.js'
A.b = 1;
// c.js
import A from './main.js'
A.c = 2;
// App.js
import A from './main.js'
console.log(A);
what i get in console.log(A)
is { a : 0 }
how to extend A
in main.js
and while import to App.js
, A
will be extended to as per below
{
a : 0,
b : 1,
c : 2
}
what i get in the browser
{
b : 1,
c : 2,
default : {
a : 0
}
}
in terminal it logged
{ a : 0 }