es6-module-transpiler-dist-formatter

raw JSON →
0.0.2 verified Fri May 01 auth: no javascript deprecated

An extension for es6-module-transpiler that outputs modules in a dist bundle format compatible with Node.js, YModules, and global variables. Version 0.0.2 is the latest stable release. This package is no longer actively maintained and has been superseded by modern bundlers like Rollup or Webpack. Key differentiator: produces legacy wrappers for multiple module systems (CommonJS, YModules, global).

error Error: Cannot find module 'es6-module-transpiler-dist-formatter'
cause Missing npm install of the package or incorrect require path.
fix
npm install es6-module-transpiler-dist-formatter --save-dev and ensure require path is correct.
gotcha The DistFormatter requires a module name option, otherwise output may be incorrect.
fix Always pass { name: 'your-module-name' } to the constructor.
deprecated es6-module-transpiler and its formatters are deprecated in favor of modern tools like Rollup.
fix Migrate to Rollup or Webpack with proper ES module output.
npm install es6-module-transpiler-dist-formatter
yarn add es6-module-transpiler-dist-formatter
pnpm add es6-module-transpiler-dist-formatter

Shows how to create a transpiler container with the DistFormatter and output a bundle.

var transpiler = require('es6-module-transpiler');
var DistFormatter = require('es6-module-transpiler-dist-formatter');
var Container = transpiler.Container;
var FileResolver = transpiler.FileResolver;

var container = new Container({
  resolvers: [new FileResolver(['lib/'])],
  formatter: new DistFormatter({ name: 'my-module' })
});
container.getModule('index');
container.write('dist/mylib.js');
console.log('Output written to dist/mylib.js');