Share application code between Node and Ember 2.x


I have an app which uses a Node backend and Ember 2.3 frontend - So there is common code which needs to be shared between Node and Ember.

I think this question is related to Best practice for sharing ES6 code between a node server and an Ember client but my Node code doesn’t use ES6 style imports and this existing discussion too was in search of a seamlessly integration with ember-cli.

Here’s something I’ve been trying.

Suppose the node code to share is located at:


Step 1: Bundle the Node code and place it at:


This step would involve bundling it using a tool like browserify but the generated code needs to use ES6 style exports.

Step 2. In ember add an import in ember-cli-build.js:


Step 3. To use the library in ember:

import foo from 'ember-app-name/node-shares/shared-code';

Steps 2 and 3 work (thanks to this tip:

How do you achieve Step 1 so that its integrated with the ember-cli build system?