I have connect
configuration for - grunt-contrib-connect
connect: {
options: {
...
},
proxies: [{...
}],
livereload: {
options: {
base: gruntTargetPath,
open: true,
middleware: function(connect, options, middlewares) {
return [
...,
connect.static('.tmp'),
connect().use('/bower_components', connect.static('./bower_components')),
connect.static(config.app)
];
}
}
}
}
When I execute on bash - grunt connect:livereload
, it prompts -
Warning: undefined is not a function Use --force to continue.
Aborted due to warnings.
(it's regarding to the connect
argument , I checked it) .
How to pass this argument correctly ?
Looks like you're calling connect rather than referencing it here:
connect().use
Should be
connect.use
Update
Looking at the documentation, the middleware function should return an array of functions with the signature
(req, res, next)
but currently you're passing an array of return values from theuse
andstatic
methods which could be anything.Their example inserts functions into the middlewars array and then return it:
If you want to stick with your current approach of returning an array literal, make sure each array item is a function with the signature expected: