matthewrobb / es6-module-transpiler-resolver-factory

ES6 Module Transpiler - Extendable multi-step FileResolver
MIT License
4 stars 0 forks source link

Extending the ResolverFactory results in errors #1

Open vnys opened 9 years ago

vnys commented 9 years ago

I’m trying to combine esnext and es6-module-transpiler, and stumbled across your module as a possible solution. However, I get the following stack trace when following the example on extending the ResolverFactory:

[09:28:12] AssertionError: {kind: var, declarations: [object Object], loc: null, type: VariableDeclaration} does not match field "init": Expression | null of type VariableDeclarator
    at add (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/types.js:525:28)
    at /Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/types.js:539:17
    at Array.forEach (native)
    at Object.defineProperty.value [as variableDeclarator] (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/types.js:538:30)
    at BundleFormatter.defaultExport (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/lib/formatters/bundle_formatter.js:214:8)
    at Context.Rewriter.visitExportDeclaration (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/lib/rewriter.js:220:62)
    at Context.invokeVisitorMethod (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:215:43)
    at Rewriter.PVp.visit (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:109:21)
    at NodePath.each (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/path.js:96:22)
    at visitChildren (/Users/victor/kode/scrooge/component/node_modules/es6-module-transpiler/node_modules/recast/node_modules/ast-types/lib/path-visitor.js:128:14)

I use es6-module-transpiler version 0.9.5.

vnys commented 9 years ago

In any case, I’m really interested to know how you combine esnext with the es6-module-transpiler if it’s not by using this module – if you could kindly point me in the right direction :)

matthewrobb commented 9 years ago

I have to look into this, I believe some key parts of recast and transpiler have changed since this module was last updated.

matthewrobb commented 9 years ago

If you are in a hurry you might try bumping the deps in the package.json and see if things just work. If not then it is likely some API has changed that I was previously relying on for Resolvers.