---
title: "Deploying an Apps Script Library Part 6: Deploying on NPM"
author: "Dmitry Kostyuk"
date: 2024-05-29T21:33:30+00:00
modified: 2024-06-03T20:55:28+00:00
canonical_url: https://pulse.appsscript.info/p/2024/05/deploying-an-apps-script-library-part-6-deploying-on-npm/
markdown_url: https://pulse.appsscript.info/p/2024/05/deploying-an-apps-script-library-part-6-deploying-on-npm.md
categories:
  - "Advanced"
  - "Library"
  - "Solutions"
tags:
  - "@wildhogsm"
  - "dmitry-kostyuk"
  - "javascript.plainenglish.io"
  - "Medium"
  - "wurkspaces.dev"
featured_image: https://pulse.appsscript.info/files/2024/05/0_YESFkDNXt2FBbQz7-e1717015312361.jpg
description: "Here's Dmitry Kostyuk's latest post in his series on 'Deploying an Apps Script Libraries'. This time Dmitry explains how to effectively use external libraries in your Apps Script projects. As part of this given that referenced Apps Script libraries can slow down your script, Dmitry explains how to bundle your dependencies directly into your code, similar to NPM modules in Node.js. The post guides you on how to choose compatible NPM modules, ensuring they don't rely on features unavailable in Apps Script. It provides a step-by-step walkthrough of installing and using NPM modules like Day.js, demonstrating how to bundle them with Vite for Apps Script compatibility. Finally, the post covers how to publish your own modules on NPM, detailing steps for bundling, testing, and deployment. It also explains how to automate the deployment process using GitHub Actions. You can read more by following the source link."
---

# Deploying an Apps Script Library Part 6: Deploying on NPM

![Deploying an Apps Script Library Part 6: Deploying on NPM](https://pulse.appsscript.info/files/2024/05/0_YESFkDNXt2FBbQz7-e1717015312361.jpg)

> ## Everyone says use Google Apps Script libraries for easier maintenance — I found a better way. Here’s why NPM modules might change the game for you too.
> 
> 
> Last time, we covered how to deploy our library as a native Google Apps Script (GAS) library using Vite, GitHub Actions, and `clasp`. This setup is efficient, but there’s a notable drawback to using Apps Script libraries.
> According to the [official guide](https://developers.google.com/apps-script/guides/libraries): *“**Warning:** A script that uses a library [doesn’t run as quickly](https://developers.google.com/apps-script/guides/support/best-practices#avoid_libraries_in_ui-heavy_scripts) as it would if all the code were contained within a single script project. Although libraries can make development and maintenance more convenient, use them sparingly in projects where speed is critical. Because of this issue, library use should be limited in [add-ons](https://developers.google.com/workspace/add-ons/overview).”*
> Apps Script is not known for its speed, being a free runtime. Slowing it down further by using native GAS libraries is generally not advisable. Therefore, I prefer to avoid native GAS libraries whenever possible.
> Instead, it’s much more efficient to bundle your dependencies directly into your source code, similar to how it’s done in Node.js. This is where NPM modules and Vite come into play.
> In this post, we’ll cover:
> 
> Which NPM modules are compatible with Google Apps Script and which ones are not.
> How to use NPM modules in your Apps Script projects.
> How to build and publish a module on NPM.
> 
> Let’s start with compatibility.

*Source: *[*Deploying an Apps Script Library Part 6: Deploying on NPM***](https://medium.com/@dmitry-kostyuk/deploying-an-apps-script-library-part-6-deploying-on-npm-ae35886d35d7?sk=bfd7983db85efbe03bee171bcc3a7f23)

---

*Published by [Dmitry Kostyuk](https://pulse.appsscript.info/p/author/dmitrykostyuk/) on [Pulse](https://pulse.appsscript.info/). Original article: [https://pulse.appsscript.info/p/2024/05/deploying-an-apps-script-library-part-6-deploying-on-npm/](https://pulse.appsscript.info/p/2024/05/deploying-an-apps-script-library-part-6-deploying-on-npm/)*
