【问题标题】:Initializers throwing error: Uncaught ReferenceError: module is not defined初始化程序抛出错误:未捕获的 ReferenceError:未定义模块
【发布时间】:2014-05-20 19:48:50
【问题描述】:

我在使用 ember-cli 0.0.28 时遇到问题。我所有的初始化程序都无法加载。我收到以下错误。

未捕获的引用错误:模块未定义

为每个初始化程序创建的每个 jshit.js 文件都会引发错误。

例子:

 define("fp-mobile/initializers/authentication.jshint", 
   [],
   function() {
     "use strict";

      ### This is the line that is blowing up.
      module('JSHint - fp-mobile/initializers');
      ### Uncaught ReferenceError: module is not defined

      test('fp-mobile/initializers/authentication.js should pass jshint', function() { 
        ok(true, 'fp-mobile/initializers/authentication.js should pass jshint.'); 
      });
   });//# sourceURL=fp-mobile/initializers/authentication.jshint.js

这是从 ember-cli 27 升级到 ember-cli 0.0.28-master-cbd7c7c264 后开始的。

任何人都知道可能导致这种情况的原因。我应该打开一个错误吗?

【问题讨论】:

    标签: javascript ember.js


    【解决方案1】:

    我通过在初始化文件中添加 .es6 扩展名解决了这个问题

    变化:

     fp-mobile/initializers/authentication.js
    

    收件人:

     fp-mobile/initializers/authentication.js.es6
    

    我想我会提交一个错误。

    编辑这并不能真正解决问题,它只是从构建中删除了初始化程序。 jshint 实现仍在进行中。

    使用 ember-cli master 并将 broccoli-JSHint 恢复到 v0.4.0 可以解决此问题。

    https://github.com/stefanpenner/ember-cli/issues/782

    编辑

    问题已解决。

    【讨论】:

      猜你喜欢
      • 2012-03-24
      • 2018-07-16
      • 2020-08-07
      • 1970-01-01
      • 2021-12-21
      • 1970-01-01
      • 2016-02-11
      • 2016-02-28
      • 2020-08-30
      相关资源
      最近更新 更多