How to publish a module written in ES6 to NPM?

前端 未结 11 613
自闭症患者
自闭症患者 2020-11-29 15:22

I was about to publish a module to NPM, when I thought about rewriting it in ES6, to both future-proof it, and learn ES6. I\'ve used Babel to transpile to ES5, and run tests

11条回答
  •  时光取名叫无心
    2020-11-29 16:04

    The pattern I have seen so far is to keep the es6 files in a src directory and build your stuff in npm's prepublish to the lib directory.

    You will need an .npmignore file, similar to .gitignore but ignoring src instead of lib.

提交回复
热议问题