It is advisable not to use jspm for arbitrary server applications currently as there are two major issues with Node module npm support that are limiting use of jspm in Node:
- Browserify transforms support (https://github.com/jspm/npm/issues/10)
- Packages with a
browserfield will always use that browser mapping even in Node (https://github.com/jspm/npm/issues/32), pending conditional loading support in SystemJS.
jspm run allows the immediate execution of any module from the command-line:
jspm install fs echo "import fs from 'fs';\ console.log(fs.readFileSync('package.json')+'');" > test.js jspm run test
jspm run, the jspm API provides an import function with the same functionality.
Node Core and Browserify support
All Node core modules are available in the jspm registry and can be installed by their names.
This includes: assert, buffer, child_process, cluster, console, constants, crypto, dgram, dns, domain, events, fs, http, https, net, os, path, process, punycode, querystring, readline, repl, stream, string_decoder, timers, tls, tty, url, util, vm, zlib.
When running in Node, they use their native implementations, and when running the browser, the Browserify core shims are used instead.