A resolver extension for es6-module-transpiler (v0.10+) that enables importing ES6 modules from npm packages using the jsnext:main flag. This package bridges npm resolution with ES6 module transpilation, allowing developers to import modules by package name (e.g., 'import foo from "foo"') instead of brittle relative paths into node_modules. Active development ceased; the last release v0.3.0 dates from 2016 and the ecosystem has moved to native ES modules or newer transpilers (Babel, TypeScript). Key differentiator: it was the first solution to integrate npm package resolution into the es6-module-transpiler pipeline via a custom resolver class, relying on the jsnext:main convention popularized by libraries like Rollup. Requires es6-module-transpiler as a peer dependency.
npm install es6-module-transpiler-npm-resolverNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to create a transpiler Container with both file resolver and NPM resolver, then compile a module and write output.
Migrate to modern module bundlers like Rollup or Webpack which support jsnext:main natively.
Ensure the npm package you are importing has 'jsnext:main' defined. If not, use a different resolver or bundle the module manually.
Do not expect to import CommonJS modules using this resolver; use a different toolchain (e.g., Babel) for transpilation.
Update es6-module-transpiler to ^0.10.0.
npm install es6-module-transpiler@^0.10.0
Use const NPMFileResolver = require('es6-module-transpiler-npm-resolver');Add 'jsnext:main': 'path/to/es6-module.js' to the package's package.json, or ensure the resolver's search paths are correct.