Closed dnalagatla closed 4 years ago
Moving to postBuild
won't make compatibility with current embroider any easier. AFAIK we don't even run that hook.
I think we should deal with this in embroider. Probably by detecting the package.json in the public tree and merging it into our own.
Hi @ef4, @rwjblue and myself investigated where embroider build is overwriting package.json generated by ember-cli-fastboot. I created this PR to merge package.json properties into package.json created by embroider.
After adding the above fix in the test app I noticed following issues with Embroider+Fastboot build:
<app>.js
file used by fastboot. - I think we may have to evaluate index.html to load all the files (vendor and app chunk JS) in the fastboot sandbox. Investigating ^ issues. Will update here. cc: @stefanpenner @rwjblue @ef4
This was closed by #178.
Reopened because the fix was reverted.
Should be fixed by #383 if I didn't missed something.
Although the PR mentioned above seems to address the issue, I am still running into it, with the latest embroider release (0.27.0).
You can see that quite well when building the fastboot-app
test-package in this repo: dist/package.json
contains none of the FastBoot manifest stuff that you see in a classic build!
In an embroider build (ember build
):
In a classic build (CLASSIC=true ember build
):
The error that I see is not the one mentioned in the original comment, but rather You must provide a hostWhitelist to retrieve the host
when trying to read request.host
. But this is also caused by the package.json being not what Fastboot expects, specifically the missing hostWhitelist
field.
Will provide a PR with a failing test...
Here is a failing test: https://github.com/embroider-build/embroider/pull/574
I don't think your problem is related to this issue. In your package.json, you can see that we did emit fastboot info, it's just that it's using schemaVersion: 5
which is much smaller (because it relies on the contents of index.html instead of duplicating that info inside package.json).
You are right, I didn't pay enough attention to the FastBoot manifest data it seems. It was just obvious that it was totally different, so I wrongly assumed Embroider had omitted something. Until I realized that Embroider has some custom adapter for ember-cli-fastboot, which seems to explain the vast difference between builds.
I think I have found a fix, will update my PR, then let's move the discussion over there...
So, as my issue is indeed not really related to this issue, which seems to have been fixed by now, I think we can close this...
My PR - https://github.com/ember-fastboot/ember-cli-fastboot/pull/690 moved the implementation form the postProcessTree to treeForPublic hook. But after doing that, I noticed embroider build doesn't add the package.json generated by
ember-cli-fastboot
addon. Instead, it keeps the package.json created by enbroider build in the dist folder. I am thinking some diff code is assuming the package.json generated as part of Fastboot tree is similar to package.json generated by embroider build and keeps embroider build related package.jsonTo Repro the issue
yarn install
page will show following error:
This error is thrown because
manifest
property is missing in generated package.json.I am thinking the fastboot generation of package.json should move to
postBuild
hook instead of usingtreeForPublic
. what do you guys think @ef4 @stefanpenner @rwjblueRelated to issue - https://github.com/embroider-build/embroider/issues/112 I missed this error during testing of my PR as the git repo mentioned in the above issue didn't include fastboot and I tested assuming ember-cli-fastboot was included as dependency. :(