# Cannot import discourse libs in markdown extensions

**URL:** https://meta.discourse.org/t/cannot-import-discourse-libs-in-markdown-extensions/137077
**Category:** Development
**Created:** [December 26, 2019, 11:24am UTC](https://meta.discourse.org/t/cannot-import-discourse-libs-in-markdown-extensions/137077 "2019-12-26T11:24:27Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [December 26, 2019, 11:24am UTC](https://meta.discourse.org/t/cannot-import-discourse-libs-in-markdown-extensions/137077/1 "2019-12-26T11:24:27Z")

</div>

Continuing the discussion from [Developer's guide to Markdown extensions](https://meta.discourse.org/t/developers-guide-to-markdown-extensions/66023/22):

* * *

My extension code is like this:

```javascript
import { iconHTML } from 'discourse-common/lib/icon-library'

export function setup(helper) {
   ...
}

```

When doing a `bundle exec rake db:create db:migrate`, I get this error:

```plaintext
== Seed from /home/jack/discourse/db/fixtures/500_categories.rb
rake aborted!
MiniRacer::RuntimeError: Error: Could not find module `discourse-common/lib/icon-library` imported from `lib/discourse-markdown/my_bbcode_plugin`

```

When running the plugin, **everything works fine in the composer** : I can use my new bbcode as expected. But when saving the post, I get this error:

```plaintext
MiniRacer::RuntimeError at /posts/30
====================================

> Error: Could not find module `discourse-common/lib/icon-library` imported from `discourse-markdown/discpage`

```

In fact, as far as I can tell, the problem occurs when trying to import **any Discourse file, except for those in the `pretty-text` folder**.

Is this the expected behavior ?

I’m on Window WSL and I noticed this [somewhat similar issue](https://meta.discourse.org/t/unable-to-create-vagrant-local-installation/48574) from @vinothkannans

---

<div class="post-metadata">

### Author: ![jack2](https://avatars.discourse-cdn.com/v4/letter/j/ac91a4/32.png) [@jack2](https://meta.discourse.org/u/jack2)
#### Post date: [December 26, 2019, 8:22pm UTC](https://meta.discourse.org/t/cannot-import-discourse-libs-in-markdown-extensions/137077/2 "2019-12-26T20:22:56Z")

</div>

I think I get it: the markdown engine is also executed server-side (to generate the cooked version of the post). Hence the fact that I cannot rely on client-side libraries.
