node.js - Using babel with node cluster -
i have simple program developed es6 , transpiled babel.
import kue 'kue'; import cluster 'cluster'; const queue = kue.createqueue(); const clusterworkersize = require('os').cpus().length; if (cluster.ismaster) { kue.app.listen(3000); (var = 0; < clusterworkersize; i++) { cluster.fork(); } } else { queue.process('email', 10, function(job, done){ ... }); }
the problem comes when run program
$ babel-node --presets es2015 program.js
the master process run without problem children crash with:
import kue 'kue';
syntaxerror: unexpected reserved word
any idea of how run children babel?
note: 1 option generate dist/ folder code transpiled es5, leave last.
the problem here child processes run under node
, not babel-node
.
try use babel require hook instead of cli.
Comments
Post a Comment