Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is babel-core/register production ready? #13

Closed
hyzhak opened this issue Mar 19, 2016 · 3 comments
Closed

Is babel-core/register production ready? #13

hyzhak opened this issue Mar 19, 2016 · 3 comments

Comments

@hyzhak
Copy link

hyzhak commented Mar 19, 2016

Can we do that way in production without falling in performance pit trap?

//  enable runtime transpilation to use ES6/7 in node

/* eslint-disable */
var fs = require('fs');
var path = require('path');

var babelrc = fs.readFileSync(path.resolve(__dirname, '../.babelrc'));
var config;

try {
  config = JSON.parse(babelrc);
} catch (err) {
  console.error('==>     ERROR: Error parsing your babelrc');
  console.error(err);
}
/* eslint-enable */

require('babel-core/register')(config);

got example from https://github.com/bdefore/universal-redux/blob/master/bin/transpile.js

@jamiebuilds
Copy link
Contributor

No and it's never going to be, it's a bad idea for production because it requires recompilation at runtime, which is the whole point of the register hook.

@hyzhak
Copy link
Author

hyzhak commented Mar 19, 2016

@thejameskyle Thanks for answering. But current example https://github.com/babel/example-node-server is product ready or at least right direction for it. Right?

@jamiebuilds
Copy link
Contributor

Yeah https://github.com/babel/example-node-server#getting-ready-for-production-use

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants