搜索

[Typescript] Get a TypeScript package ready for release to NPM


发布时间: 2022-11-24 17:42:03    浏览次数:12 次

If you're thinking about putting a TypeScript package up to NPM, you should be considering preconstruct. It makes setup EXTREMELY easy and takes many decisions out of your hands.

Here, we get a package ready for release in under 2 minutes.

https://preconstruct.tools/tutorials/

Install:

yarn add -D @preconstruct/cli

 

Run:

yarn preconstruct fix

 

will add "main"in package.json automaticlly.

 

If we add "module": "",in package.json, then run yarn preconstruct fixagain, it will automiaticlly handle add `.esm.js` file for us.

 

Add script:

"build": "yarn preconstruct build"

 

Run:

yarn build

It will generate /dist folder with all the code you need.

 

Then you can publish your package to NPM

免责声明 [Typescript] Get a TypeScript package ready for release to NPM,资源类别:文本, 浏览次数:12 次, 文件大小:-- , 由本站蜘蛛搜索收录2022-11-24 05:42:03。此页面由程序自动采集,只作交流和学习使用,本站不储存任何资源文件,如有侵权内容请联系我们举报删除, 感谢您对本站的支持。 原文链接:https://www.cnblogs.com/Answer1215/p/16809779.html