Organizational Research By

Surprising Reserch Topic

how to use node js module system on the clientside


how to use node js module system on the clientside  using -'javascript,node.js'

I would like to use the CommonJS module system in a clientside javascript application. I chose nodejs as implementation but can't find any tutorial or docs on how to use nodejs clientside, ie without using node application.js

I included node.js like this in my html page:

<script type="text/javascript" src="node.js"></script>


Note that I didn't make nodejs on my local machine, I'm on Windows anyway (I'm aware of the Cygwin option).
When I want to use the require function in my own javascript it says it's undefined.

var logger = require('./logger');


My question is, is it possible to use nodejs like this?
    
asked Sep 18, 2015 by jekbishnoi
0 votes
55 views



Related Hot Questions



Government Jobs Opening

foo =

From the module description:

Browserify

Browser-side require() for your node modules and npm packages**

Browserify bundles everything ahead-of-time at the mount point you specify. None of this ajaxy module loading business.

More features:

  • recursively bundle dependencies of npm modules
  • uses es5-shim for browsers that suck
  • filters for {min,ugl}ification
  • coffee script works too!
answered Sep 18, 2015 by mannar kande
0 votes

If you'd like to write code for browser with same style modules as you do for Node.js, try Webmake. Take a look also at simple prototype of application build that way: SoundCloud Playlist Manager

answered Sep 18, 2015 by devkumargupta

...