AMD Library Compiler

raw JSON →
0.1.9 verified Fri May 01 auth: no javascript abandoned

A Node.js CLI tool (v0.1.9) that compiles AMD-style modules into a standalone library file with global namespace exposure, as opposed to app-specific loaders like RequireJS. It produces three files: a minified build (via Uglify-js), an inline source file, and a development file with synchronous module loading. Last updated in 2013; appears unmaintained. Use for legacy AMD projects only; modern projects should favor ES modules.

error Error: Cannot find module 'amdlc'
cause Package not installed locally or globally.
fix
Run 'npm install -g amdlc' for CLI, or 'npm install amdlc' for programmatic use.
error TypeError: amdlc.compile is not a function
cause Incorrect import (ESM import used instead of require).
fix
Use 'var amdlc = require("amdlc");'
error Error: Anonymous modules not supported
cause Module defined without a name in define().
fix
Use define('moduleName', [...], function() { ... });
gotcha Anonymous modules are not implemented; all modules must have a named define() call.
fix Use named modules in AMD define('moduleName', [...]);
gotcha Relative module dependencies (e.g., ./MyModule) are not supported.
fix Use absolute paths or configure baseDir correctly; use full module names.
deprecated Package has not been updated since 2013; relies on unmaintained Uglify-js version.
fix Consider switching to ES modules with Rollup or Webpack.
gotcha The 'excludeRootNamespaceFromPath' option is misspelled (excludeRootNamespaceFromPath). Must match exactly.
fix Use the exact option name as shown in documentation.
npm install amdlc
yarn add amdlc
pnpm add amdlc

Compiles all AMD modules in src/ into a standalone library with three output files.

var amdlc = require("amdlc");

amdlc.compile({
    from: "src/**/*.js",
    baseDir: "src",
    compress: true,
    expose: "public",
    excludeRootNamespaceFromPath: true,
    verbose: true,
    outputSource: "out/lib.js",
    outputMinified: "out/lib.min.js",
    outputDev: "out/lib.dev.js"
});