es6-module-transpiler-package-resolver

raw JSON →
1.0.1 verified Fri May 01 auth: no javascript maintenance

A file resolver for the ES6 Module Transpiler that resolves files in projects using Ember.js-style package structure. Version 1.0.1 is the latest stable release, with no further updates since 2015. It is a legacy tool for pre-ES6 module transpilation, dependent on es6-module-transpiler ~0.9.0. Differentiators: supports Ember-style package layout (packages/*/lib/). Currently in maintenance mode as the ES module ecosystem has moved to native ESM.

error Cannot find module 'es6-module-transpiler-package-resolver'
cause Package not installed or missing npm install
fix
Run: npm install es6-module-transpiler-package-resolver
error PackageResolver is not a constructor
cause Forgetting 'new' keyword or using ES import syntax on CommonJS module
fix
Use: var PackageResolver = require('es6-module-transpiler-package-resolver'); then new PackageResolver([...]);
error TypeError: roots.forEach is not a function
cause Passing a string instead of an array to PackageResolver constructor
fix
Wrap the path in an array: new PackageResolver(['./packages'])
deprecated Package is unmaintained since 2015. Consider using native ES modules or modern bundlers (Webpack, Rollup).
fix Migrate to native ES module syntax with a bundler or switch to @babel/preset-env for transpilation.
gotcha The resolver expects packages to be laid out as packages/<name>/lib/<file>.js. If your structure differs (e.g., packages/<name>/src/), resolution will fail.
fix Ensure your package directories follow the expected structure, or use a custom resolver.
gotcha PackageResolver must be instantiated with an array of root paths, even if only one root. Passing a string will cause type errors.
fix Wrap the path in an array: new PackageResolver(['./packages']).
npm install es6-module-transpiler-package-resolver
yarn add es6-module-transpiler-package-resolver
pnpm add es6-module-transpiler-package-resolver

Shows basic usage with ES6 Module Transpiler: create a container with PackageResolver and compile an app module.

var PackageResolver = require('es6-module-transpiler-package-resolver');
var Container = require('es6-module-transpiler').Container;
var BundleFormatter = require('es6-module-transpiler').formatters.bundle;

var container = new Container({
  formatter: new BundleFormatter(),
  resolvers: [new PackageResolver(['./packages'])]
});

// Assuming packages/app/lib/main.js exists and exports something
var output = container.compile('app');
console.log(output);