例子:
最后返回的结果是:
{
default: function fn2(){ },
foo2: 1,
test3: {
default: function fn3(){ },
foo3: 1
}
}
// app.js
// import json from './1.json';
import * as all from './test2';
import fn2 from './test2'; console.log(all);
console.log(all.default === fn2); // true
console.log(fn2); // test2.js
function fn2(){
console.log(1);
} export default fn2;
var foo2 = 1;
export {foo2};
export * as test3 from './test3'; // test3.js
function fn3(){
console.log(1);
} var foo3 = 1;
export {foo3}; export default fn3;