componentjs / builder2.js

builder for component
50 stars 20 forks source link

Error with conditional requiring #56

Closed bergie closed 10 years ago

bergie commented 10 years ago

In NoFlo we support both browser and Node.js, and I'm currently looking to port our build setup to the new builder2 to get rid of issues like component/builder.js#125.

However, it seems the builder's require normalization can't deal with conditional requires, like:

unless exports.isBrowser()
  exports.ComponentLoader = require('./nodejs/ComponentLoader').ComponentLoader
else
  exports.ComponentLoader = require('./ComponentLoader').ComponentLoader

There have been similar issues reported before but apparently closed unresolved #36

I'm trying to wrap this into a Grunt plugin, and looking at scripts.js, resolution errors on local project get thrown. This makes my build fail:

screenshot 2014-04-24 at 20 45 52

jonathanong commented 10 years ago

gah i guess we can just make it a warning. i hate when people do this stuff and try/catchs.

lvivier commented 10 years ago

+1 to making this a warning, we do lots of models with modella and they all require in different storage plugins and stuff depending on the environment

timaschew commented 10 years ago

fixed in #73