JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1679
  • Score
    100M100P100Q107632F
  • License MIT

RequireJS/AMD on Node.js

Package Exports

  • node-amd

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (node-amd) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

node-amd

Aim of this project is to make AMD modules usable in nodejs. Useful for reusing client-side data model code on the server-side.

Why do you not use amdefine?

amdefine forces one to add this -> if (typeof define !== 'function') { var define = require('amdefine')(module) } to each module, which is inconvenient. node-amd declares globals.

Usage

require('./node-amd.js');

requirejs.config({
    baseUrl: '../../http-dev/',
    paths: {
        jquery: 'lib/jquery/dist/jquery'
    }
});

define(['web/model/BaseModel', 'jquery'], function (BaseModel, $) {
    //...
});

Not supported yet