Menu

Create a typescript package with Parcel

DEV Community: parcel·Léo Pradel·6 months ago
#8jNpjaKa
#dev#class#code#highlight#package
Reading 0:00
15s threshold

So, you've got this idea for a TypeScript package, but configuring build tools isn't your idea of a good time? Parcel is there to save the day!

Parcel is a fast and zero-configuration web application bundler designed to simplify the build process for modern web projects. It's not limited to web applications, and it can be used to build packages targeting the browser or Node.js.

In this tutorial, we will create a new typescript package using Parcel and configure it to output both CommonJS and ECMAScript modules.

Create a new typescript package

Start by creating a new directory and initializing your project with npm:

mkdir my-package cd my-package npm init -y npm install --save-dev typescript parcel @parcel/packager-ts @parcel/transformer-typescript-types @parcel/validator-typescript

This will create a new directory called my-package and initialize a new package.json file with the default values and install the required dependencies.

Configure Parcel

To configure Parcel, we need to edit the…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.