What is the “module” package.json field for?

前端 未结 2 1268
醉话见心
醉话见心 2020-11-30 22:59

I\'ve seen some npm packages (vue for example) have a pkg.module field in their package.json. Is \"module\" an official npm property or is this a c

2条回答
  •  南方客
    南方客 (楼主)
    2020-11-30 23:45

    Is "module" an official npm property or is this a convention of some kind?

    It's a proposal, but likely to be supported due to de facto usage.

    Is there documentation for this somewhere?

    There is, in fact, and it can be found right here and later removed here.

    What's it for?

    ES6 Module Interoperability in Node. Additional discussion can be found here and here. And here's a blog post from Rich Harris talking more about it.

提交回复
热议问题