How to Build an NPM Package for ESM and CJS
Use Snyk for free to find and fix security issues in your applications today! https://snyk.co/ugLYn
In this video, we show you how to build an NPM package that is compatible with ESM and CJS. Have you built an NPM package before? if so, share it down below in the comments!
Read more about how to build an npm package for ESM and CJS in our related blog: https://snyk.co/ugXDj
✍️ Resources ✍️
- Example Code Repository - https://github.com/snyk-snippets/package-json-exports
- tsup package: https://snyk.co/ugXDn
⏲️ Chapters ⏲️
00:00 - How your package can support ESM and CJS modules
00:41 - Using the "main" property to target ESM
02:00 - Exploring the "main" and "module" properties
03:20 - Exploring the "exports" property
04:01 - How to provide type support with Typescript
05:22 - Keeping your package secure with Snyk
07:52 - Summary
08:35 - Outro
⚒️ About Snyk ⚒️
Snyk helps you find and fix vulnerabilities in your code, open-source dependencies, containers, infrastructure-as-code, software pipelines, IDEs, and more! Move fast, stay secure.
Learn more about Snyk: https://snyk.co/ugLYl
📱 Connect with Us 📱
🖥️ Website: https://snyk.co/ugLYl
🐦 X: http://twitter.com/snyksec
💼 LinkedIn: https://www.linkedin.com/company/snyk
💬 Discord: https://discord.gg/devsecops-community-918181751526948884
- ️ Subscribe: https://www.youtube.com/c/SnykSec
- 🔥 We're hiring! Check our open roles: https://snyk.co/ugLYp
🔗 Hashtags 🔗
#DevSecOps #npm #javascript #coding #code #javascript #datasecurity #ESM #CJS #Developer
#coding #code #javascript #datasecurity #ESM #CJS #Developer