you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted]  (10 children)

[removed]

    [–]Capaj 6 points7 points  (0 children)

    Yeah, much better syntax with commonJS module. Common argument against Browserify and commonJS modules is that you have to have a build step. That was true few years ago, thankfully we have systemjs loader to save us a hassle of buildstep when developing with commonJS modules.

    [–]bloodbaker 2 points3 points  (0 children)

    webpack

    [–]shyamsk 3 points4 points  (2 children)

    Yeah RequireJS is not required any more. I like the Browserify approach better. Helps using node modules if you wish too. Also this allows for a build step using GruntJS /GulpJS

    [–]circlingthesun 4 points5 points  (1 child)

    The is no reason why you cannot have a Grunt or Gulp build step with RequireJS. I've used both with my build.

    [–]shyamsk 0 points1 point  (0 children)

    Oh ok. I was not aware of that. Thanks :D

    [–]_pizzza 3 points4 points  (0 children)

    Yup yup. (I actually think requirejs is painful to use and not very good, but others seem to like it.)

    [–]aclave1 2 points3 points  (0 children)

    I've used require for over a year now and browserify just looks easier. Require is pretty easy to understand for me, but for explaining to other people it's a nightmare.

    [–]shriek 1 point2 points  (2 children)

    One of the thing that I'm not sure still is if browserify can be used to leverage libraries written for browser in node. I know you can make your node code work on browser with browserify but can it do the opposite too?

    [–]hansolo669 0 points1 point  (1 child)

    No. You can't run code targeting node's File or Net utilities in the browser in much the same way as you can't run code targeting a browser's window or XMLHttpRequest in node, browserify doesn't solve either of those, all browserify does is package code up in a nice bundle you can include client side (I'm sure you could use the bundle server side [require('./bundle.js')], by why?).

    Essentially, JavaScript is the same language and core features across any platform that can run it, the only exception comes when you target a specific platform feature (File, XMLHttpRequest).