use compose() throw "app.use require a generator function"
tiodot opened this issue · comments
I write three generator ,a
, b
and c
:
use compose:
var all = compose([a, b, c]);
app.use(all);
run, then throw a error:
app.use require a generator function
Then I try:
app.use(a);
app.use(b);
app.use(c);
It work well.
try npm i --save koa-compose@2
koa-compose@3 has breaking chages for koa@2
Since Koa v2 is still alpha (and I don't expect to want to use it until async/await are native!), could you dist-tag koa-compose@3.0.0 as 'next' in npm, with 2.3.0 as 'latest'? (as Koa itself is dist-tagged, in fact).
+1 for koa-compose@3 as next
peerDependencies :D
Even better! I stand corrected :)
@chrisveness peerDependencies aren't better because they're deprecated in npm 3. They still give you a warning when the deps don't match up, but that could change in the next version.
Ok, I thought peerDependencies had simply changed in npm 3 (warning instead of auto-installing), I wasn't aware they were deprecated; however, I'm happy to bow to the experts (@tj, @tejasmanohar), I just want want Koa 1 dependencies to work smoothly for me until such time as async/await are native in v8 and I can go to Koa 2 without transpiling – I'm not really worried about how it happens...
@chrisveness
a) not an expert
b) I may be wrong about peerDependencies- will check on that. You should get koa-compose@2.3.0 when you npm install koa-compose
now (at least, you will on latest NPM). See here.
@chrisveness You're right about peerDependencies. My bad. +1 for that. // cc @tj
Good stuff, thx for dist-tags
kia-compose's latest is v2 so this should no longer be a problem