An error occurred while processing a template (Cannot read property 'js' of undefined).
dmitryevseev opened this issue · 11 comments
Using module v0.4.5.
Here is the task config:
ngconstant: {
options: {
space: ' '
},
development: {
constants: { API_CONFIG: { baseUrl: 'http://localhost:8080/api' } },
dest: 'source/js/env-config.js',
name: 'environment-config',
wrap: 'define(["angular"], function (angular) {\n"use strict";\n<%= __ngModule %>});'
}
And this is grunt output:
Verifying property ngconstant.development exists in config...OK
Files: -> source/js/env-config.js
Reading /../node_modules/grunt-ng-constant/tasks/constant.tpl.ejs...OK
Warning: An error occurred while processing a template (Cannot read property 'js' of undefined). Use --force to continue.
Appreciate your help.
I am unable to reproduce it. I ran your configuration without any error.
Which node version are you using?
It's v0.10.21
Comment removed. See configs below.
Can you reproduce it when you are not using your generateEnvConfig
function and only execute grunt ngconstant:development
?
It would be nice if you could create a minimal example project where I can reproduce it.
If I leave everything apart of ng-constant from Gruntfile.js it works. Seems like some module interfering with it. Digging for more details
Alright, here goes minimal setup: https://gist.github.com/dmitryevseev/7428655
It boils down for me to ng-constant
+ jshint
.
It's resolved after updating jshint config (see new revision of gist). Still not sure why jshint task was breaking ng-constant.
Thats strage cause I am using jshint too for testing. What was exactly your change in the jshint config?
Yep, that's it
It seemed that app_files
variable was not defined, which caused the error. I don't know why this happened in the ngconstant
task instead of jshint
but this was a configuration error.
Closed for now.
@mlegenhausen Thanks for your time spent to help with this!