ember-fastboot / ember-cli-fastboot

Server-side rendering for Ember.js apps
http://ember-fastboot.com/
MIT License
851 stars 160 forks source link

treeForFastBoot is not handled correctly when project is an addon #807

Closed simonihmig closed 3 years ago

simonihmig commented 3 years ago

When build the dummy app of an addon, the treeForFastBoot hook is handled differently then when the addon is included in a real app.

First the treeForFastBoot hook is called as expected for the addon here. Let's asume the hook return a modified version of the addons /fastboot folder through some broccoli transforms.But then on the following lines, the original folder (this.project.root + '/fastboot') is merged on top of that, basically overriding all the changes that the treeForFastBoot hook provided.

I believe the latter part is correct for an app, but when the project is an addon this should not happen, as the addon's fastboot tree is already handled before.

xg-wang commented 3 years ago

It's not clear to me how this issue once blocked https://github.com/kaliber5/ember-responsive-image/pull/113. Is this just double work from ember-cli-fastboot to process project addon's fastboot tree or there's more?

simonihmig commented 3 years ago

@xg-wang The issue was that the tree I was returning from the hook (which was my /fastboot folder but with some broccoli replacement magic) was always overriden by the original files due to this bug. In my PR I worked around this issue for now by some trickery (basically renaming /fastboot): https://github.com/kaliber5/ember-responsive-image/pull/113/files#diff-e727e4bdf3657fd1d798edcd6b099d6e092f8573cba266154583a746bba0f346R207-R209