A JavaScript module bundler and client-side loader that constructs a minimal set of bundles for dependency graphs with both static and dynamic dependencies. Version 0.4.11 (alpha, last release 2017) supports CommonJS static requires and node-ensure dynamic declarations, targeting isomorphic apps. Unlike Browserify or Webpack, it handles the 'dynamic dependency diamond' by ensuring each module is in exactly one bundle and dynamic requests deliver only the required static subgraph. Works on Node.js and in browsers via generated bundles.
npm install dynapackVerified import paths — ran on the pinned version, not inferred.
Builds bundles from an entry module with static and dynamic dependencies, writing each bundle to disk.
Consider Webpack, Rollup, or Parcel for modern bundling.
Use the exact pattern: var __m = './path' /*js*/; followed by ensure([__m], cb).
Pipe bundle source through uglify-js: uglifyjs bundle.js -c -m -o bundle.min.js
Use CommonJS require() syntax only.
Use the callback pattern or promisify manually.
npm install node-ensure
Use const dynapack = require('dynapack');Rewrite to CommonJS: var x = require('module');Check that the mainPath resolves to a valid .js file.