Comments (6)
It's hard to say something based on this information. It seems you have a file that is not annotated, isn't passed to ng-annotate and is passed to a minifier later on. This is basically the only reason why this error may occur.
It's weird, though, that it worked for you with ngmin and didn't work with ng-annotate. Are you sure this works with ngmin? Maybe you changed something else as well?
If you set up a repo with a simple example with ngmin working and ng-annotate not, I could have a look. Otherwise it's hard to help.
I'll close this issue for now as I'm pretty sure it's a simple configuration error but feel free to post updates here.
from grunt-ng-annotate.
The only thing i did was to change my package.json
- "grunt-ngmin": "0.0.3",
+ "grunt-ng-annotate": "1.0.1",
and then in my gruntfile.js i put
grunt.loadNpmTasks('grunt-ng-annotate');
then changed what I put on the issue, and finally changed this
grunt.registerTask('build', [
'clean:dist',
'wiredep',
'useminPrepare',
'concurrent:dist',
'autoprefixer',
'concat',
- 'ngmin',
+ 'ngAnnotate',
'copy:dist',
'removelogging',
'cssmin',
'uglify',
'ngtemplates',
'filerev',
'usemin',
'htmlmin',
'appcache'
]);
It's completely working with grunt-ngmin.. So my only guess is that maybe grunt-ng-annotate may be incompatible with something else or i'm missing some other configuration.. It's an error at angular.js annotated file/minified file, so I don't know what I should do.
from grunt-ng-annotate.
Could you (both with ngAnnotate & ngmin) run Grunt with the --verbose
--debug --stack flags and see if both ngmin & ngAnnotate pick up the same
files?
Michał Gołębiowski
from grunt-ng-annotate.
I've mixed up the potential reasons - it might be that ngAnnotate doesn't annotate a particular portion of your file because its heuristics don't detect one of the places that need annotatiion. In such cases you need to insert an /* ngInject */
comment. Could you post here part of the file definining ClientGroup
? Its dependencies are not annotated for some reason.
from grunt-ng-annotate.
ClientGroup is a service generated with the following code
var addr = location.hostname;
var constants = {
'serverAddress': addr + '/api/',
'resources': {
'ClientGroup': {
'endpoint': 'lab/client_group'
},
}
};
var service = angular.module('myApp.services', ['ngResource']);
var resourceObjects = constants.resources;
function addResourceFactoryToService(service, resource, resourceEndPoint){
service.factory(resource, function ($resource, $http, $cookies) {
return $resource(
constants.serverAddress + resourceEndPoint + '/:id',
// Creates a PUT method defined as 'update'
{ id: '@id'},
{
update: {
method: 'PUT',
params: {id: '@id'}
},
query: {
method: 'GET',
isArray: false,
transformResponse: function(data){
var response = angular.fromJson(data);
if(response instanceof Array) {
var object = { count: response.length, results: []};
for(var i=0; i< response.length; i++){
object.results[i] = response[i];
}
return object;
}
else {
return response;
}
}
},
get: {
method: 'GET',
isArray: false
}
}
);
});
}
for (var resource in resourceObjects) {
if (resourceObjects.hasOwnProperty(resource)) {
addResourceFactoryToService(service, resource, resourceObjects[resource].endpoint);
}
}
from grunt-ng-annotate.
I'd guess ng-annotate heuristics can't find the factory definition, you need to annotate it via "ngInject"
. Read more at https://github.com/olov/ng-annotate.
Anyway, this is related to ng-annotate output so the place to report any potential issues is https://github.com/olov/ng-annotate/issues, this repo is just a Grunt task for this module.
from grunt-ng-annotate.
Related Issues (20)
- Can we ignore files in globbing? HOT 6
- Task appends to existing file instead of rewriting it HOT 3
- timeline for 2.0.0 release HOT 3
- how ng-annotate check if it is an angular-based js? HOT 1
- ngAnnotate fails on es6 classes that have a constructor but no methods HOT 1
- Missing rule HOT 1
- ngAnnotate:dist - Error when parsing .tmp file HOT 7
- Could we please get a new release for more recent ng-annotate version HOT 1
- upgrade to 2.0.1 then "customizer is not a function" HOT 4
- angular 1.5 component definition breaks ng-annotate. HOT 2
- About angular-bootstrap $uibmodal resolve annotate! HOT 3
- Angular 1.5.8 component template ng-inject HOT 1
- Need support for Angular 1.5 component's controller HOT 1
- Conditional Files HOT 2
- separator option ignored? HOT 2
- Getting Strict mode error on latest version HOT 4
- Doesn't seem to annotate inline controllers? HOT 1
- ng-Annotate HOT 5
- ngAnnotate:dist - Error of parsing during build HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grunt-ng-annotate.