ember build - 获取错误“controllers / application-compiled.js:第1行,第1列,使用”use strict“的函数形式。”

时间:2015-06-04 19:50:48

标签: ember.js

Ember JS的新手。使用:

➜  rarwe git:(master) ✗ ember -v
version: 0.2.7
node: 0.12.4
npm: 2.11.0

我正在尝试运行ember构建,但是我得到了错误:

➜  rarwe git:(master) ✗ ember build
version: 0.2.7
Building.
controllers/application-compiled.js: line 1, col 1, Use the function form of "use strict".
controllers/application-compiled.js: line 3, col 23, 'exports' is not defined.
controllers/application-compiled.js: line 9, col 14, 'require' is not defined.
controllers/application-compiled.js: line 44, col 1, 'exports' is not defined.
controllers/application-compiled.js: line 46, col 1, 'module' is not defined.
controllers/application-compiled.js: line 46, col 18, 'exports' is not defined.

6 errors

===== 1 JSHint Error

Built project successfully. Stored in "dist/".

任何帮助将不胜感激。

嗨,Blong ...感谢您的关注......以下是文件controllers / application-compiled.js的内容:

var checker   = require('ember-cli-version-checker');

module.exports = {
  name: 'ember-cli-babel',

  shouldSetupRegistryInIncluded: function() {
    return !checker.isAbove(this, '0.2.0');
  },

  setupPreprocessorRegistry: function(type, registry) {
    var addon = this;

    registry.add('js', {
      name: 'ember-cli-babel',
      ext: 'js',
      toTree: function(tree) {
        return require('broccoli-babel-transpiler')(tree, getOptions(addon));
      }
    });
  },

  included: function(app) {
    this._super.included.apply(this, arguments);
    this.app = app;

    if (this.shouldSetupRegistryInIncluded()) {
      this.setupPreprocessorRegistry('parent', app.registry);
    }
  }
};

function getOptions(addonContext) {
  var baseOptions = (addonContext.parent && addonContext.parent.options) || (addonContext.app && addonContext.app.options),
      options = baseOptions && baseOptions['babel'] || {};
  // Ensure modules aren't compiled unless explicitly set to compile
  options.blacklist = options.blacklist || ['es6.modules'];

  // do not enable non-standard transforms
  if (!('nonStandard' in options)) {
    options.nonStandard = false;
  }

  if (options.compileModules === true) {
    if (options.blacklist.indexOf('es6.modules') >= 0) {
      options.blacklist.splice(options.blacklist.indexOf('es6.modules'), 1);
    }

    delete options.compileModules;
  } else {
    if (options.blacklist.indexOf('es6.modules') < 0) {
      options.blacklist.push('es6.modules');
    }
  }

  // Ember-CLI inserts its own 'use strict' directive
  options.blacklist.push('useStrict');
  options.highlightCode = false;

  return options;
}

0 个答案:

没有答案