module.exports that include all functions in a single line

前端 未结 6 1011
小鲜肉
小鲜肉 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 10:53

    It is worth noting that in ES6, you can now export functions like this:

    export function foo(){}
    export function bar(){}
    function zemba(){}
    

    Simply write export before the functions you want to export. More information here.

提交回复
热议问题