ES6 export all values from object

前端 未结 9 1797
梦谈多话
梦谈多话 2020-11-28 07:32

Say I have a module (./my-module.js) that has an object which should be its return value:

let values = { a: 1, b: 2, c: 3 }

// \"export values\         


        
9条回答
  •  臣服心动
    2020-11-28 08:18

    Does not seem so. Quote from ECMAScript 6 modules: the final syntax:

    You may be wondering – why do we need named exports if we could simply default-export objects (like CommonJS)? The answer is that you can’t enforce a static structure via objects and lose all of the associated advantages (described in the next section).

提交回复
热议问题