Hem vs browserify

80 views
Skip to first unread message

Chris Nelson

unread,
Feb 6, 2012, 11:18:36 PM2/6/12
to spi...@googlegroups.com
So I was playing around with Hem and was curious as to how it's supposed to work with npm modules.  Does it actually parse the package.json and look at the main property so it runs the right file when you require a module in code?  In my brief experiments it didn't seem to, whereas browserify I believe does.  I thought I'd ask what the intent was.

--Chris

Alex MacCaw

unread,
Feb 6, 2012, 11:36:52 PM2/6/12
to spi...@googlegroups.com
Yes, browserify is a bit more advanced in that respect - Hem doesn't do that.


On Mon, Feb 6, 2012 at 8:18 PM, Chris Nelson <ch...@gaslightsoftware.com> wrote:
So I was playing around with Hem and was curious as to how it's supposed to work with npm modules.  Does it actually parse the package.json and look at the main property so it runs the right file when you require a module in code?  In my brief experiments it didn't seem to, whereas browserify I believe does.  I thought I'd ask what the intent was.

--Chris



--
Alex MacCaw

+12147175129
@maccman

http://alexmaccaw.co.uk

Richard Flosi

unread,
Apr 9, 2014, 11:53:03 AM4/9/14
to spi...@googlegroups.com, ch...@gaslightsoftware.com
We just started playing with idea recently and found that browserify has some trouble with relative require paths that hem handles as expected.
I think we just need to setup some transformations in browserify to make it work more like hem.

For example, with hem I can require('./foo') and that will include foo.js relative to my current directory, whereas browserify translates ./foo as from the app/ directory (in the case of a spine app). I like using the relative paths that hem allows because it makes it super easy to move directories around if I need/want to reorganize the project.

hem also allows me to do require('bar') where 'bar' is not a node module, but just a top level bar.js file. hem also allows me to do require('bar/baz') to require a bar/baz.js relative to the app/ directory whereas browserify wants me to do require('./bar/baz').

Suggestions welcome.

Thanks!

Patrick Mulder

unread,
Apr 10, 2014, 2:56:55 AM4/10/14
to spi...@googlegroups.com
I add symlinks into a pathe app/node_modules 

you can then require('views/foo') given a symlink node_modules/views

Von meinem iPhone gesendet
--
You received this message because you are subscribed to the Google Groups "Spine" group.
To unsubscribe from this group and stop receiving emails from it, send an email to spinejs+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages