# How to ship javascript library with plugin?

**URL:** <https://meta.discourse.org/t/how-to-ship-javascript-library-with-plugin/53190>\
**Category:** Development\
**Created:** [November 21, 2016, 12:07pm UTC](https://meta.discourse.org/t/how-to-ship-javascript-library-with-plugin/53190 "2016-11-21T12:07:04Z")\
**Posts on this page:** 1\
**Showing post:** 8

<div class="post-metadata">

**Author:** ![DawnPaladin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/dawnpaladin/32/207237_2.png) [@DawnPaladin](https://meta.discourse.org/u/DawnPaladin)\
**Post date:** [April 21, 2021, 12:20am UTC](https://meta.discourse.org/t/how-to-ship-javascript-library-with-plugin/53190/8 "2021-04-21T00:20:21Z")

</div>

Sorry for necroing this thread, but this is where Google has brought me. I’ve been trying for a couple of hours to get a JS library to load inside my plugin.

- In my app’s assets/javascripts folder, I have a file named argdown-core.js.
- In my plugin.rb file, I’m doing `register_asset 'javascripts/argdown-core.js'`.
- In assets/javascripts/discourse-markdown/argdown.js.es6, I’m doing `import { argdown } from "argdown-core.js"`.

I’ve tried lots of variations on the above and I keep getting `Uncaught Error: Could not find module argdown-core.js imported from discourse/plugins/Argdown/discourse-markdown/argdown`.

Some of the things I’ve tried:

- Moving the file into various folders
- Lots of permutations on the `import` line
- Putting .es6 on the file extension - other JS files seem to need that to run
- Putting `:server_side` at the end of my `register_asset` line in plugin.rb, since that’s where this should run
- Looking for other plugins that require third-party libraries - can’t find any that use strategies I’m not using
- Digging through Discourse’s code to try to understand the bundling system

This is probably simple and there’s something obvious I’m missing. Can anyone help?

---

_[View the full topic](https://meta.discourse.org/t/how-to-ship-javascript-library-with-plugin/53190)._
