Embroider build replaces Fastboot generated package.json
See original GitHub issueMy 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.json
To Repro the issue
- clone - https://github.com/dnalagatla/my-embroider-test.git
- run
yarn install
- ember s
- launch http://localhost:4200
page will show following error:
Error: /var/folders/tv/fgbbtzvd1f1dbv45y7r8l09m000ty_/T/broccoli-82821i0tVejhn4W1b/out-176-packager_runner_embroider_webpack/package.json was malformed or did not contain a manifest. Ensure that you have a compatible version of ember-cli-fastboot.
at EmberApp.readPackageJSON (/Users/dnalagat/DEVELOPMENT/ember-cli-fastboot/node_modules/fastboot/src/ember-app.js:362:13)
at new EmberApp (/Users/dnalagat/DEVELOPMENT/ember-cli-fastboot/node_modules/fastboot/src/ember-app.js:34:23)
at FastBoot._buildEmberApp (/Users/dnalagat/DEVELOPMENT/ember-cli-fastboot/node_modules/fastboot/src/index.js:114:17)
at new FastBoot (/Users/dnalagat/DEVELOPMENT/ember-cli-fastboot/node_modules/fastboot/src/index.js:52:10)
at app.use (/Users/dnalagat/DEVELOPMENT/ember-cli-fastboot/index.js:318:29)
at Layer.handle [as handle_request] (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/express/lib/router/layer.js:95:5)
at trim_prefix (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/express/lib/router/index.js:317:13)
at /Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/express/lib/router/index.js:284:7
at Function.process_params (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/express/lib/router/index.js:335:12)
at next (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/express/lib/router/index.js:275:10)
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 using treeForPublic
. what do you guys think @ef4 @stefanpenner @rwjblue
Related 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. 😦
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (7 by maintainers)
Top GitHub Comments
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.
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