[英]Angularjs (Error: $injector:modulerr Module Error) on concatenating bower components?
When i'm concatenating bower_components of angularjs (angular & ui-router) using grunt, 当我使用grunt串联angularjs(angular&ui-router)的bower_components时,
I get a (Error: $injector:modulerr Module Error)
Complete error here https://goo.gl/0yz6pm 我收到一个
(Error: $injector:modulerr Module Error)
此处完整错误https://goo.gl/0yz6pm
on the built script. 在生成的脚本上。
I DO NOT get this error when i'm using the script source directly from the bower_components 当我直接从bower_components使用脚本源时,我没有收到此错误
Therefore i think it's an issue with concatenation by grunt. 因此,我认为这是一个咕gr串联的问题。
Below is the grunt script, 下面是咕unt的脚本,
grunt.initConfig({
concat:{
options: {
},
dist: {
// the files to concatenate
src: ['client/bower_components/angular/angular.min.js','client/bower_components/angular-ui-router/release/angular-ui-router.min.js'],
// the location of the resulting JS file
dest: 'client/bower_components/../assets/scripts/coreScript.js',
nonull: true
}
}
})
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.registerTask('build',['concat']);
}
I've also tried using a seperator:';'
我也尝试过使用
seperator:';'
in options
but to no help. options
但没有帮助。
What can i do to make concatenation work here? 我该怎么做才能在此处进行串联?
This setup looks fine, assuming all those script references are correct and you are referencing coreScript.js on your page. 假设所有这些脚本引用均正确并且您在页面上引用coreScript.js,则此设置看起来不错。 The only issue I can see here is your call to
.registerTask
. 我在这里看到的唯一问题是您对
.registerTask
的调用。 Observe your implementation 观察您的实施
grunt.registerTask('build','concat']);
However, grunt is expecting a task array 但是,咕unt声期待一个任务数组
grunt.registerTask('build', ['concat']); // close array with [
Could it be this task is not successfully running because of this issue? 是否可能因为此问题而无法成功运行此任务? I am also not seeing a call to
readJSON
. 我也没有看到
readJSON
的电话。 Could you be also missing the following in your gruntfile.js declaration? 您还可能在gruntfile.js声明中缺少以下内容吗?
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
// ...
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.