ForbesLindesay / browserify-middleware

express middleware for browserify, done right
http://browserify.org
MIT License
381 stars 66 forks source link

Support per-module options to allow custom expose names #11

Closed KylePDavis closed 10 years ago

KylePDavis commented 11 years ago

Here's how we might teach browserify-middleware to pass the expose option (or any other future options down) to the browserify.require() method.

KylePDavis commented 11 years ago

See issue #9

ForbesLindesay commented 11 years ago

Lets only support the oneform. The short form only saves a few characters and having two versions just makes everything more complicated. The long form is also more generally useful.

How about something like:

{
  'module-name': {expose: 'mod'}
}

We could do that instead of an array, letting people do:

browserify({'module-a': {expose: 'moda'}, 'module-b': {expose: 'modb'}})

and then the short option of:

browserify(['module-a', 'module-b'])

for when you don't want to pass any options?

KylePDavis commented 10 years ago

Updated lib/send.js as per your comment before. Also, merged with latest. Anything else?

iammerrick commented 10 years ago

Please merge this :-). I super want it.

ForbesLindesay commented 10 years ago

I've refactored slightly to get an API I was more happy with, but the updated version is now released as 2.0.0 (along with browserify 3.0 support)