Registry / serialization / es6-module-transpiler-globals-formatter

es6-module-transpiler-globals-formatter

JSON →
library0.1.1jsnpmunverified

Extension for the es6-module-transpiler that outputs exported module values as globals. Version 0.1.1 appears to be the only release; no release cadence indicated. Unlike the default BundleFormatter which keeps exports internal, this formatter assigns exported values to a named global object (e.g., window.myGlobal). Useful for exposing an ES6 module bundle as a global variable in legacy environments. Note that the transpiler repo is also archived, making this an abandoned approach.

npm install es6-module-transpiler-globals-formatter
INSTALL
IMPORT
SIG · ES6-MODULE-TRANSPI
E
es6-module-transpiler-globals-formatter
serializationjavascriptv0.1.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

GlobalFormatter
var GlobalsFormatter = require('es6-module-transpiler-globals-formatter');
CJS only; no default export, must require the module.

Basic usage: configure a transpiler container with GlobalsFormatter to output ES6 module exports as a single global object.

var GlobalsFormatter = require('es6-module-transpiler-globals-formatter'); var transpiler = require('es6-module-transpiler'); var Container = transpiler.Container; var FileResolver = transpiler.FileResolver; var container = new Container({ resolvers: [new FileResolver(['lib/'])], formatter: new GlobalsFormatter({globalName: 'myGlobal'}) }); container.getModule('index'); container.write('out/mylib.js');
Debug
Known issues
gotchaThis package depends on the now-abandoned es6-module-transpiler, which is no longer maintained.
fix
Consider switching to a modern module bundler like Rollup or Webpack.
affects: >=0.1.0
gotchaGlobal object assignments use this.exportedValues at runtime, which may cause conflicts with existing globals.
fix
Ensure the globalName is unique and not already used in the target environment.
affects: >=0.1.0
gotchaOnly one version (0.1.1) was ever published; no updates since 2014.
fix
Do not rely on future maintenance.
affects: 0.1.1
Errors
Common errors & fixes
Cannot find module 'es6-module-transpiler'
Missing peer dependency es6-module-transpiler.
fix
npm install es6-module-transpiler --save-dev
TypeError: GlobalsFormatter is not a constructor
Using ES import syntax or destructuring incorrectly; require returns the constructor directly.
fix
Use var GlobalsFormatter = require('es6-module-transpiler-globals-formatter');
Upgrade
Version history
0.1.1latest on npm
Audit
Dependencies
es6-module-transpilerrequiredThis package extends the transpiler's Container and formatter interface.
Agent activity
4 hits · last 30 days
node
4
Resources
es6-module-transpiler-globals-formatter — npm install es6-module-transpiler-globals-formatter · libregistry