module.exports that include all functions in a single line

前端 未结 6 1005
小鲜肉
小鲜肉 2021-02-05 10:19

This is a follow-up question to In Node.js, how do I "include" functions from my other files?

I would like to include an external js file that contains common

6条回答
  •  滥情空心
    2021-02-05 11:05

    If you use ES6 you can do something like that:

    function bar() {
       //bar
    }
    
    function foo() {
       //foo
    }
    
    export default { bar, foo };

提交回复
热议问题