es6-module-transpiler-package-resolver
v1.0.1
Published
Resolves files in projects using the Ember.js-style package structure.
Maintainers
Readme
Package Resolver
This resolver is intended to work with the ES6 Module Transpiler to provide file resolution for projects written using the "package" style, e.g.
packages/
utils/
lib/
string.js
main.js
app/
lib/
main.jsGiven this package structure and the "packages" directory as a root, "utils/string" would be resolved to "utils/lib/string.js", "app" would be resolved to "app/lib/main.js", etc. This project format is used by Ember.js.
Install
$ npm install [--save-dev] es6-module-transpiler-package-resolverUsage
When used directly with the ES6 Module Transpiler, just use it the same way you would FileResolver but give it all
your "packages" directories:
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'])
});You can also use it with tools like Broccoli via plugins such as broccoli-compile-modules:
// Brocfile.js
var PackageResolver = require('es6-module-transpiler-package-resolver');
var compileModules = require('broccoli-compile-modules');
module.exports = compileModules('packages', {
inputFiles: ['app'],
resolvers: [PackageResolver],
formatter: 'bundle'
});Contributing
- Fork this project.
- Create a branch for your bug fix or feature.
- Commit to that branch, ensuring you update and add tests as appropriate.
- Submit a pull request with a description of the bug or feature, links to any relevant resources, etc.
Thanks!
