Npm does not restrict itself to Node.js or Node.js only modules, so it can be useful for sharing modules for the browser (though it has what seems to me to be an unnecessary restriction against upper-case characters in module names). Might requirejs either allow:
Of course, it would be ideal if the same code written for the browser in this manner could still work in Node as well.
It is best if either the package manager or a command line helper tool either creates an adapter module so that 1) 'example.js' points to the 'main' module in the 'example' directory, or 2) enters a paths or packages config in a requirejs config block. It could then also convert the modules to amd format for example too.
volo does path 1) create an adapter module. If the project that volo installs into is an AMD project, it will also try to convert any node/cjs modules to amd format.
Unfortunately, npm as-is lays out code that is not very helpful for dynamic loading for the browser.
A loader in the browser should also not try to do http requests for a package.json as that will lead to 404s in some cases, and it is extra requests that can be avoided by laying out the files and directories, and creating an adapter module once. JSON fetching is also subject to CORS rules, which leads to support requests.
So no plans to add functionality in this area, as the right solution is better command line tools for project setup.
The "same module system in node and browser" will likely have to wait until ECMAScript modules land.
As far as ES6 modules and command line helpers, this looks interesting: https://github.com/umdjs/es6-module-transpiler .
Despite this, I still think it would be useful to have something for on-the-fly loading, as it is very valuable to debug without an intermediate step of using the command line, even if just one command. I am therefore interested to take a closer look at/try out https://github.com/jspm/jspm-loader/ .
And just now saw your https://github.com/jrburke/require-hm