From 211b323e361c966adef3d2a23bb3518f6fdd7aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jose=CC=81=20Magalha=CC=83es?= Date: Sat, 28 Mar 2015 17:25:17 +0000 Subject: [PATCH] fix option to disable bable register on runtime --- .gitignore | 1 + index.js | 8 +++++--- package.json | 4 ++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index c2658d7..32ec2ff 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ +*.log node_modules/ diff --git a/index.js b/index.js index c9d7deb..40a8341 100644 --- a/index.js +++ b/index.js @@ -1,18 +1,20 @@ 'use strict'; var React = require('react'); -var merge = require('lodash.merge'); +var defaults = require('lodash.defaults'); var path = require('path'); module.exports = function engineFactory (engineOptions) { - engineOptions = merge(engineOptions || {}, { + engineOptions = defaults(engineOptions || {}, { extension: '.jsx', babel: {}, docType: '', staticMarkup: false }); - require('babel/register')(engineOptions.babel); + if (engineOptions.babel) { + require('babel/register')(engineOptions.babel); + } return function renderComponent (filename, options, callback) { options = options || {}; diff --git a/package.json b/package.json index 1bd43e3..b9e2679 100644 --- a/package.json +++ b/package.json @@ -20,8 +20,8 @@ "react": "^0.13.1" }, "dependencies": { - "lodash.merge": "^3.0.2", - "babel": "^4.7.16" + "babel": "^4.7.16", + "lodash.defaults": "^3.1.0" }, "devDependencies": { "react": "^0.13.1"