【发布时间】:2019-07-14 19:32:24
【问题描述】:
我正在使用 angular-meteor (Angular1) 开发一个网络应用程序。这使用 webpack 作为模块捆绑器。自从我开始我就发现不可能将 npm/bower 模块注入我的应用程序模块。
我经常遇到以下错误:
Error: [$injector:nomod] Module xxx is not available! You either misspelled the module name or forgot to load it. If registering a module ensure that you specify the dependencies as the second argument.
我通常遵循官方文档,其中包括:
- 下载 npm 模块
- 在我的 index.html 中包含脚本
- 将模块添加到我的应用模块中
但这总是会出现上述错误。
然后我尝试不同的技术,例如使用以下方法在页面顶部导入模块:
import exampleModule from 'angular-example-module';
并将 exampleModule 添加到我的模块列表中,但似乎没有任何效果。
我以前使用没有 webpack 的 angular,从来没有遇到过这个问题。我错过了什么吗?有什么我不知道的特定程序吗?
【问题讨论】:
标签: angularjs webpack module angular-meteor