# How to import code packages in the JavaScript column

**URL:** <https://community.glideapps.com/t/how-to-import-code-packages-in-the-javascript-column/34466>\
**Category:** Ask for Help\
**Created:** [November 13, 2021, 4:05pm UTC](https://community.glideapps.com/t/how-to-import-code-packages-in-the-javascript-column/34466 "2021-11-13T16:05:19Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![david](https://sea2.discourse-cdn.com/flex002/user_avatar/community.glideapps.com/david/32/62831_2.png) [@david](https://community.glideapps.com/u/david)\
**Post date:** [November 13, 2021, 4:05pm UTC](https://community.glideapps.com/t/how-to-import-code-packages-in-the-javascript-column/34466/1 "2021-11-13T16:05:19Z")

</div>

The [JavaScript column](https://www.glideapps.com/plugins/hell-yes-code) already includes [`lodash`](https://lodash.com/), which provides a value named `_` with many useful utility functions. `lodash` is the most popular JavaScript library in the world, so we included it by default even if you do not use it.

@Jeff_Hager recently [requested](https://github.com/glideapps/glide-code-columns/issues/82) `mathjs` support in the JavaScript column. `mathjs` is another top JavaScript library, but including it by default means that every app that uses the JavaScript column would load this library as well, even though very few people need it.

Today I discovered how you can load _any_ JavaScript package within the JavaScript column using [skypack.dev](https://www.skypack.dev/) and a newer JavaScript feature called `async import`.

## Example: Load `mathjs` to evaluate a complex expression:

```js
// Use await import to load the package:
const mathjs = await import("https://cdn.skypack.dev/mathjs");

// Use any function in the package:
return mathjs.evaluate("sin(45 deg) ^ 2");

```

Alternatively, you could use JavaScript object destructuring syntax to import `evaluate` more specifically:

```js
const { evaluate } = await import("https://cdn.skypack.dev/mathjs");
return evaluate("sin(45 deg) ^ 2");

```

Instead of evaluating a constant string, pass a parameter to give your app calculation superpowers!

```js
const { evaluate } = await import("https://cdn.skypack.dev/mathjs");
const result = evaluate(p1);
return typeof result === 'number' ? result : result.toString();

```

 ![image](https://us1.discourse-cdn.com/flex002/uploads/glideapps/original/3X/b/5/b5977de5f18c264d33ecbaad83818abc3a1b061c.png)

You can search for thousands of popular packages on skypack and import them in this way.

Please share any interesting things you do with this power!

---

_[View the full topic](https://community.glideapps.com/t/how-to-import-code-packages-in-the-javascript-column/34466)._
