# A versioned API for client side plugins

**URL:** https://meta.discourse.org/t/a-versioned-api-for-client-side-plugins/40051
**Category:** Development
**Tags:** rest-api
**Created:** [February 23, 2016, 7:20pm UTC](https://meta.discourse.org/t/a-versioned-api-for-client-side-plugins/40051 "2016-02-23T19:20:31Z")
**Posts on this page:** 1
**Showing post:** 36

<div class="post-metadata">

### Author: ![LeoMcA](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/leomca/32/87233_2.png) [@LeoMcA](https://meta.discourse.org/u/LeoMcA)
#### Post date: [July 3, 2016, 5:50pm UTC](https://meta.discourse.org/t/a-versioned-api-for-client-side-plugins/40051/36 "2016-07-03T17:50:08Z")

</div>

It may well be that there are no versions of Discourse for which `noApi` support is needed anymore, so this might be irrelevant, but I can’t seem to work out how to import a module which doesn’t exist in later versions of Discourse, in order to provide backwards compatibility, without breaking the plugin in those later versions.

The completely expected error I get (in the later versions) is:

```javascript
Error: Could not find module `discourse/components/hamburger-menu` imported from `discourse/plugins/static-pages/discourse/initializers/static-pages-menu`

```

When trying:

```javascript
import HamburgerMenuComponent from 'discourse/components/hamburger-menu';

```

As far as I’m aware, conditional imports aren’t possible in ES6, are they?

---

_[View the full topic](https://meta.discourse.org/t/a-versioned-api-for-client-side-plugins/40051)._
