petehunt / node-jsx

transparently require() jsx from within node
164 stars 32 forks source link

Options is not used until node-jsx is required. #33

Closed jontelm closed 9 years ago

jontelm commented 9 years ago

If node-jsx is required after example Express, all express files will be checked by node-jsx but without options. So require node-jsx before express, otherwise will it take some extra time to start node / express.

Wrong:

var express = require('express'), // node-jsx options is empty here
    fs = require('fs'), // node-jsx options is empty here
    passport = require('passport'), // node-jsx options is empty here
    nodeJSX = require('node-jsx').install({extension: '.jsx'}); // It's here the options starts to take action and only jsx will be checked.

Right:

var nodeJSX = require('node-jsx').install({extension: '.jsx'}),
    express = require('express'),
    fs = require('fs'),
    passport = require('passport');

Not a big deal, but maybe something we should add to the readme ?

mweitzel commented 9 years ago

Things like require and load order are pretty fundamental to node, but not this library. I think it'd be a little out of place to include in this readme.

jontelm commented 9 years ago

Yes, I agree. This issue can maybe help someone later on.