---
title: "Discussion on \"Create an npm package easily in JavaScript/TypeScript\" | Hashnode"
description: "Discussion on \"Create an npm package easily in JavaScript/TypeScript\". Hello good people! In this article, we're going to create an npm package step by step. By the end of this article you will be able to:\n\nBuild your own package\nUse it on other projects\nPublish it on npm\n[Bonus] Publish your TypeScript types with your ..."
url: "https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Create an npm package easily in JavaScript/TypeScript](https://blog.tarekjellali.com/create-an-npm-package-easily-in-javascript-typescript?utm_source=hashnode&utm_medium=feed)

Hello good people! In this article, we're going to create an npm package step by step. By the end of this article you will be able to: Build your own package Use it on other projects Publish it on npm \[Bonus\] Publish your TypeScript types with your ...

May 17, 2021 · 11 min read · blog.tarekjellali.com  
Updated May 30, 2021  
Read the article

-   [#npm](https://hashnode.com/tag/npm)
-   [#package](https://hashnode.com/tag/package)
-   [#typescript](https://hashnode.com/tag/typescript)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#webpack](https://hashnode.com/tag/webpack)

## Written by

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

@tarek-jellali · Paris, France

  
[View profile](https://hashnode.com/@tarek-jellali)

Software Engineer

Software Engineer • TypeScript • JavaScript • Angular • VueJS • WordPress • Ex-founder of ng-enious

## Responses 6

Markdown supported · ⌘↵ to post

[Wade Wilson](https://hashnode.com/@WadeWilson)

[Oct 17, 2023](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/652ec9e87fb06929fec68d8b)

1.  it takes 5 minutes to push your example into github project and linking it here
2.  building with tsc does not allow you yo use \*.css|scss files

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

[Oct 17, 2023](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/652ec9e87fb06929fec68d8b#reply-652ecc857fb06929fec68de5)

Hello there, I'm not sure I understand your first point, the repo is available [here](https://github.com/tarkant/build-npm-package-example) and evey step in the guide has the commit id + link to commit reflecting that step.

As for your second point, correct, TSC does not build and bundle scss. I didn't mention CSS/SCSS bundling for a package to keep things really simple. If you think I need to address it, I can add a bonus section for sure 😊 .

[Wade Wilson](https://hashnode.com/@WadeWilson)

[Oct 17, 2023](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/652ec9e87fb06929fec68d8b#reply-652edd2e10ce1729cebad1e9)

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

1.  I ment it would be so much easier to understand what is going on if we could see full-code example (GitHub repo).
2.  Any React component package contains some sort of styling - as far as I'm concerned it gets very messy when you're trying to add styles to TSC

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

[Nov 11, 2023](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/652ec9e87fb06929fec68d8b#reply-654f8b49d03f881958ba585d)

[Wade Wilson](https://hashnode.com/@WadeWilson) I get what you mean. This is more a general guide to help someone new to the world of npm packages to get started.

In any case I like what you're suggesting, I think this deserves a part 2 with something more advanced 😃 !

[Rodrigo](https://hashnode.com/@rodrigomd)

[May 22, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a969f620d1f45ceb7ee828)

Great article Tarek, to be honest, I haven't published a package yet so this will help me with my next project

Thanks a lot!

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

[May 22, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a969f620d1f45ceb7ee828#reply-60a9776720d1f45ceb7ee88d)

Very happy you liked it, [Rodrigo](https://hashnode.com/@rodrigomd)! I hope it'll come helpful to you yes! 🙌

[Andrew Baisden](https://hashnode.com/@andrewbaisden)

[May 20, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a63a434e7f9549fc330a3e)

Awesome already bookmarked it this will come in useful later.

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

[May 20, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a63a434e7f9549fc330a3e#reply-60a64d044e7f9549fc330c81)

Happy to read that, thank you so much 🙌 !

[Piyush Garg](https://hashnode.com/@piyushgarg)

[May 19, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a5051359b7dc409c3d37d3)

Great article. 🚀

[Kieran Roberts](https://hashnode.com/@kieran6roberts)

[May 19, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a4aa285c1fcb4077364466)

That was a really great article [Tarek Jellali](https://hashnode.com/@tarek-jellali). As someone who has never self-published a package before I was curious to know how it was done and this explained things really well!

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

[May 19, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a4aa285c1fcb4077364466#reply-60a4cf1c59b7dc409c3d2e9f)

Thanks you so much Kieran! So happy you liked it 😀 !

[Favourite Jome](https://hashnode.com/@Favourite)

[May 18, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a4015059b7dc409c3d22e9)

Awesome Article!, I did code along until it was time to deploy to npm. I didn't want to do that.

Thanks for sharing though, it's good knowing how packages are made.

[Tarek Jellali](https://hashnode.com/@tarek-jellali)

[May 18, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a4015059b7dc409c3d22e9#reply-60a415365c1fcb4077363e6f)

Very glad you've enjoyed it!

Honestly, my goal was to demystify how npm packages are made. I used to think that it was complicated and cumbersome. All the articles I found were talking about tools and other things that can make beginners just give up.

[Favourite Jome](https://hashnode.com/@Favourite)

[May 18, 2021](https://hashnode.com/posts/create-an-npm-package-easily-in-javascript-typescript/60a2ccdb3ef3832fdd0fa03c/comment/60a4015059b7dc409c3d22e9#reply-60a43f6759b7dc409c3d2546)

I glad you took a different approach then 😊[Tarek Jellali](https://hashnode.com/@tarek-jellali)

I found the article easy to follow along.
