Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

postprocessTree never called when consumed by addon #34

Closed
asakusuma opened this issue May 22, 2015 · 6 comments
Closed

postprocessTree never called when consumed by addon #34

asakusuma opened this issue May 22, 2015 · 6 comments

Comments

@asakusuma
Copy link
Collaborator

I suspect this is an ember-cli issue, but when an addon uses ember-browserify, the consuming application will throw this error:

$ ember build
version: 0.2.5
Build failed.
Path or pattern "browserify/browserify.js" did not match any files
Error: Path or pattern "browserify/browserify.js" did not match any files
    at Object.multiGlob (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli-kitchen-sink-helpers/index.js:202:13)
    at Class.module.exports.CachingWriter.extend.addFiles (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/concat-with-maps.js:74:13)
    at Class.module.exports.CachingWriter.extend.updateCache (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/concat-with-maps.js:52:12)
    at /Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli-sourcemap-concat/node_modules/broccoli-caching-writer/index.js:92:34
    at lib$rsvp$$internal$$tryCatch (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:501:17)
    at lib$rsvp$$internal$$publish (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:472:11)
    at lib$rsvp$asap$$flush (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1290:9)
    at process._tickCallback (node.js:355:11)

This has something to do with the fact that postprocessTree is not called on ember-browserify, which is not a direct depedency of the app.

I reproduced this in a dummy app here: https://github.com/asakusuma/nested-ember-browserify

@ef4
Copy link
Owner

ef4 commented May 22, 2015

Yes, this is a general ember-cli limitation. It needs better support for recursive addon hooks. Conceptually I think it could be made it work without any changes to ember-browserify.

@asakusuma
Copy link
Collaborator Author

Ok I tried propagating the hook calls in the addon down to ember-browserify: asakusuma/uses-ember-browserify@0a5a206

I don't quite understand the new error because postprocessTree seems to be passing a valid tree. @stefanpenner got any workarounds for recursive hook calls?

$ ember build
version: 0.2.5
Build failed.
Cannot read property 'rebuild' of undefined
TypeError: Cannot read property 'rebuild' of undefined
    at Builder.wrapIfNecessary (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli/lib/builder.js:136:18)
    at readAndReturnNodeFor (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli/lib/builder.js:44:17)
    at /Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/broccoli/lib/builder.js:22:14
    at lib$rsvp$$internal$$tryCatch (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:489:16)
    at lib$rsvp$$internal$$invokeCallback (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:501:17)
    at /Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1095:13
    at lib$rsvp$asap$$flush (/Users/akusuma/workspace/opensource/nested-ember-browserify/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1290:9)
    at process._tickCallback (node.js:355:11)

@stefanpenner
Copy link
Collaborator

@stefanpenner got any workarounds for recursive hook calls?

nope

@stefanpenner
Copy link
Collaborator

@chadhietala's pre-packager work supports nested NPM imports correctly. https://github.com/chadhietala/ember-cli-pre-packager

The plan is for this eventually to part of ember-cli (once its complete)

@asakusuma
Copy link
Collaborator Author

Alright, I'll just bug @chadhietala to get it done faster haha

Closing, thanks guys

@stefanpenner
Copy link
Collaborator

Alright, I'll just bug @chadhietala to get it done faster haha

i suspect you know where to find him ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants