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

[fastboot-fix]: Only define 'fetch' when FastBoot is available #70

Closed
wants to merge 1 commit into from

Conversation

majew7
Copy link

@majew7 majew7 commented Sep 8, 2017

This PR is a fork to fix Issue #69

Don't want this file fastboot-fetch.js to go to browser, when not using FastBoot.

@arjansingh
Copy link

@kratiahuja Are @majew7 and I doing it right? 😁

@kratiahuja
Copy link
Collaborator

Huh how is this file going to browser? It will be part of the dist but never part of index.html.

@arjansingh
Copy link

arjansingh commented Sep 9, 2017 via email

@kratiahuja
Copy link
Collaborator

Something doesn't seem right then. This asset should never be loaded in browser. While the fix will mitigate the issue, I would rather like to understand why it behaving unexpectedly.

@arjansingh
Copy link

arjansingh commented Sep 9, 2017 via email

@kratiahuja
Copy link
Collaborator

Sounds good.

@nlfurniss
Copy link
Collaborator

@arjansingh a dummy app would be great (or at least post back your convo with krati from Slack) so if this issue comes up again we will better understand the issue and solution!

@arjansingh
Copy link

@kratiahuja @nlfurniss arjansingh/ember-bugs#1 That's little branch I did off of my bugs repo that duplicates the bug. Feel free to checkout the branch and use it to debug.

@arjansingh
Copy link

Anyone have a chance to debug this? Should we create an issue in the ember-cli-fastboot repo for better tracking?

@kratiahuja
Copy link
Collaborator

@arjansingh sorry i haven't had a chance to look at it. I'll take a look at it tomorrow.

@kratiahuja
Copy link
Collaborator

kratiahuja commented Sep 22, 2017

@arjansingh @majew7 I looked at the repo. I don't see fastboot-fetch.js being included in the vendor.js or app.js or engine. As mentioned earlier, it will be part of dist since we need it to be dist if an app has fastboot addon installed for it to be used (which is why you see it in the source) but it isn't being used unless you add ember-cli-fastboot addon. You could consider it as an asset that is packaged but never asked for. Therefore, I don't see why you need this check.

I am tempted to close this PR but I will wait for you guys to respond on why you think think this needed.

@arjansingh
Copy link

arjansingh commented Sep 22, 2017 via email

@kratiahuja
Copy link
Collaborator

I am pretty sure that this file will never called in the browser. The reason you are seeing it in the browser is because you are seeing the source of your engine dist.

@kratiahuja
Copy link
Collaborator

The file is only going to be eval'd in the fastboot: https://github.com/ember-cli/ember-fetch/blob/master/index.js#L91

@arjansingh
Copy link

arjansingh commented Sep 29, 2017

@kratiahuja I updated arjansingh/ember-bugs#1 to actually call ember-fetch. It most definitely throws an error now:

screen shot 2017-09-29 at 3 37 48 pm

screen shot 2017-09-29 at 3 46 45 pm

@kratiahuja
Copy link
Collaborator

kratiahuja commented Oct 2, 2017

@arjansingh So I looked at this your repro, the reason fetch is getting replaced by fastboot implementation is because the asset-manifest.json (generated by engines) is asking the browser to go fetch fastboot-fetch.js which it should not. You will see an entry of fastboot-fetch.js in there. There are other fastboot assets (like fastboot-moment) also in the asset-manifest.json. I don't know enough about how this asset-manifest is generated but this looks like an engines bug to me.

A workaround that worked on your repro app is to move ember-fetch from engine's dependency to app's dependency and then I could see the page getting rendered.

I definitely think this is not a ember-fetch bug but a bug in ember engine build. While this PR will resolve your issue but you will end up fetching un required assets for your app which isn't good. I would recommend looking into to see why engine build is adding these assets to asset-manifest.json which is used in the browser.

@arjansingh
Copy link

arjansingh commented Oct 2, 2017 via email

@kratiahuja
Copy link
Collaborator

It's an engines issue so you should open it in engines repo.

@kratiahuja
Copy link
Collaborator

@arjansingh I am going to close this PR. I think Trent confirmed this is an issue in ember engies. Please feel free to reopen if you disagree.

@kratiahuja kratiahuja closed this Oct 12, 2017
@arjansingh
Copy link

arjansingh commented Oct 12, 2017 via email

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

Successfully merging this pull request may close these issues.

4 participants