【问题标题】:Angular Meteor app works in localhost but fails when deployed to serverAngular Meteor 应用程序在 localhost 中工作,但在部署到服务器时失败
【发布时间】:2015-12-24 18:51:35
【问题描述】:

使用 angular-with-blaze 包的 Angular Meteor 应用程序在 localhost 上运行良好,但是当使用 mupmupx 部署到服务器时,站点会部分加载并在浏览器 JS 控制台中抛出以下错误:

Error: [$injector:modulerr] Failed to instantiate module myApp due to:
Error: [$injector:unpr] Unknown provider: e

认为这是由于 JS 文件的缩小,我为 mupx 尝试了以下设置,但没有帮助。

"buildOptions": {
  // build with the debug mode on
  "debug": true
}

对解决此问题有什么建议吗?

【问题讨论】:

  • 看起来可能是 Angular 缩小问题。添加 strict-di (docs.angularjs.org/error/$injector/strictdi) 以便您也可以在开发时调试此更改并查看是否出现该问题。此外,您可以将 Angular JS 文件转换为 .ng.js 以使 ng-annotate 开箱即用。
  • @Urigo standard-minifiers 包是否支持 angular-with-blaze ?当我尝试部署到模数或星系时,我得到了缩小错误?但是,如果我删除标准压缩包,它似乎部署得很好。

标签: javascript angularjs meteor angular-meteor


【解决方案1】:

如果您分别使用 gulp 或 grunt-ng-annotate,请尝试使用 gulp 任务“gulp-ng-annotate”。它将根据角度Dependency Annotation为您的模块中的依赖项添加所需的注释。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-11-21
    • 1970-01-01
    • 2016-05-12
    • 2022-11-03
    • 1970-01-01
    • 1970-01-01
    • 2021-01-17
    • 1970-01-01
    相关资源
    最近更新 更多