javascriptjquerytemplatesember.jshtmlbars

Ember.js: "Can't find variable: exports"


I started compiling my Ember.js templates server-side using the "ember-template-compiler.js" file mentioned here.

After compiling my templates and transpiling the output with Babel, I get a file which contains all of my templates assigned to an object called "export". Here are the first few lines:

"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});

exports["default"] = Ember.HTMLBars.template((function () {
  return {
    meta: {
...

Now I've integrated jQuery, "ember.prod.js" and that file within the front-end. I thought it would work, but the only thing I get from the console, is:

ReferenceError: Can't find variable: exports

Why is "exports" not defined?

P.S.: Usually, I would use "ember-cli" for all of this. But in my current project, I need to do everything by myself (please don't ask, why).

But it should work, am I right? I mean, I did it exactly like it was stated here.


Solution

  • Fixed the problem by writing my own template compiler for Gulp istead of trying to use the one in Ember CLI: https://github.com/leo/gulp-ember-compiler