{"id":25245,"library":"es6-module-transpiler-npm-resolver","title":"ES6 Module Transpiler NPM Resolver","description":"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.","status":"deprecated","version":"0.3.0","language":"javascript","source_language":"en","source_url":"https://github.com/caridy/es6-module-transpiler-npm-resolver","tags":["javascript","es6","module","transpiler","resolver","npm","jsnext"],"install":[{"cmd":"npm install es6-module-transpiler-npm-resolver","lang":"bash","label":"npm"},{"cmd":"yarn add es6-module-transpiler-npm-resolver","lang":"bash","label":"yarn"},{"cmd":"pnpm add es6-module-transpiler-npm-resolver","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"peer dependency required to provide Container, FileResolver, and formatters","package":"es6-module-transpiler","optional":false}],"imports":[{"note":"The package exports a single ES6 class as default export. In older Node.js with require(), use require().default.","wrong":"const NPMFileResolver = require('es6-module-transpiler-npm-resolver').default","symbol":"default","correct":"import NPMFileResolver from 'es6-module-transpiler-npm-resolver'"},{"note":"CommonJS require returns the constructor directly, not an object with named exports.","wrong":"const NPMFileResolver = require('es6-module-transpiler-npm-resolver').NPMFileResolver","symbol":"NPMFileResolver","correct":"const NPMFileResolver = require('es6-module-transpiler-npm-resolver');"},{"note":"Correct for es6-module-transpiler v0.10; Container is a named export from that package.","wrong":"const Container = require('es6-module-transpiler').Container;","symbol":"Container","correct":"const { Container } = require('es6-module-transpiler');"}],"quickstart":{"code":"const transpiler = require('es6-module-transpiler');\nconst Container = transpiler.Container;\nconst FileResolver = transpiler.FileResolver;\nconst NPMFileResolver = require('es6-module-transpiler-npm-resolver');\nconst formatters = require('es6-module-transpiler/lib/formatters');\nconst Formatter = formatters[formatters.DEFAULT];\n\nconst container = new Container({\n  resolvers: [\n    new FileResolver(['lib/']),\n    new NPMFileResolver([process.cwd()])\n  ],\n  formatter: new Formatter()\n});\n\ncontainer.getModule('index');\ncontainer.write('out/mylib.js');\nconsole.log('Build complete.');","lang":"javascript","description":"Shows how to create a transpiler Container with both file resolver and NPM resolver, then compile a module and write output."},"warnings":[{"fix":"Migrate to modern module bundlers like Rollup or Webpack which support jsnext:main natively.","message":"Package is no longer maintained; no updates since 2016.","severity":"deprecated","affected_versions":">=0.0.0"},{"fix":"Ensure the npm package you are importing has 'jsnext:main' defined. If not, use a different resolver or bundle the module manually.","message":"The resolver only works with packages that have a jsnext:main field in package.json; otherwise it throws a lookup error.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Do not expect to import CommonJS modules using this resolver; use a different toolchain (e.g., Babel) for transpilation.","message":"This resolver does NOT provide interoperability between ES6 modules and CommonJS modules. It only resolves ES6 source files within npm packages.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Update es6-module-transpiler to ^0.10.0.","message":"v0.3.0 requires es6-module-transpiler >=0.10.0. Using an older version of the transpiler will cause resolution failures.","severity":"breaking","affected_versions":"0.3.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"npm install es6-module-transpiler@^0.10.0","cause":"Missing peer dependency es6-module-transpiler.","error":"Error: Cannot find module 'es6-module-transpiler'"},{"fix":"Use const NPMFileResolver = require('es6-module-transpiler-npm-resolver');","cause":"Using wrong import style; e.g., require() without .default or wrong destructuring.","error":"TypeError: NPMFileResolver is not a constructor"},{"fix":"Add 'jsnext:main': 'path/to/es6-module.js' to the package's package.json, or ensure the resolver's search paths are correct.","cause":"The npm package 'foo' does not have a 'jsnext:main' field in its package.json.","error":"Error: Module 'foo' not found"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}