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

Embroider + Fastboot: dist folder doesn't include <app-name>.js file #184

Open
dnalagatla opened this issue May 19, 2019 · 5 comments
Open

Comments

@dnalagatla
Copy link
Contributor

dnalagatla commented May 19, 2019

After fixing issue #160, Noticed the embroider build doesn't include <app-name>.js file in the dist location. As a result, fastboot application fails with following error:

Error: ENOENT: no such file or directory, open '/var/folders/tv/fgbbtzvd1f1dbv45y7r8l09m000ty_/T/broccoli-53698yzwFiXaeI7ds/out-173-packager_runner_embroider_webpack/assets/my-embroider-test.js'
    at Object.openSync (fs.js:450:3)
    at Object.readFileSync (fs.js:350:35)
    at /Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/fastboot/src/ember-app.js:162:24
    at Array.forEach (<anonymous>)
    at EmberApp.loadAppFiles (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/fastboot/src/ember-app.js:160:18)
    at EmberApp.retrieveSandboxedApp (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/fastboot/src/ember-app.js:201:10)
    at new EmberApp (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/fastboot/src/ember-app.js:59:21)
    at FastBoot._buildEmberApp (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/fastboot/src/index.js:114:17)
    at new FastBoot (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/fastboot/src/index.js:52:10)
    at app.use (/Users/dnalagat/DEVELOPMENT/test-pemberly-bpr/test-ember/my-embroider-test/node_modules/ember-cli-fastboot/index.js:320:29)

my-ebroider-test is the app name.

Is there a way build can provide list of APP files that is loaded in index.html. I initially explored idea of evaluating index.html, but that may not be a good idea as html file can include browser specific script files such as impression tracking.

@stefanpenner @ef4 @rwjblue

@dnalagatla dnalagatla changed the title Embroider + Fastboot: dist folder doesn't include <app>.js file. App file is needed for fastboot. Embroider + Fastboot: dist folder doesn't include <app-name>.js file May 19, 2019
@ef4
Copy link
Contributor

ef4 commented May 19, 2019

One thing that is different about embroider vs classic ember-cli is that embroider does not expose control over the set of bundles that will appear in the output. It's deliberately abstracted, so that stage3 has the maximum freedom to optimize.

While we wouldn't want to "evaluate" index.html, we can certainly parse it and discover all the scripts that match up with assets on disk. That is the real ground truth for which scripts are needed to boot the app.

I think that is the kind of interface we want to use going forward. The compatibility system can deal with the fact that existing apps will be surprised to have some of their scripts evaluated in node by annotating them or adding fastboot guards to them.

@dnalagatla
Copy link
Contributor Author

dnalagatla commented May 21, 2019

Thank you @ef4. I used the wrong term - "evaluate". I was referring to parsing.

Your above suggestion looks good regarding checking the file name and comparing to files on disk. I think this parsing should happen as part of the build and update fastboot manifest instead of happening during runtime. I was wondering what will be a good way to know when the build is complete.

@ef4
Copy link
Contributor

ef4 commented May 21, 2019

There are a few possibilities here.

One is to make embroider generate the fastboot manifest. It would happen right after the stage3 packager has finished.

Another is to extend fastboot to not need a manifest. IMO it's conceptually cleaner to make fastboot start from the HTML, the same way the browser does. I know that there are fastboot-only scripts that appear in the manifest and not index.html, but we can express that with dynamic imports. This is good because it avoids making fastboot so special. Tooling that understands dynamic imports (a standard Javascript feature) will understand that we have these particular modules that may load sometimes but not others.

It would be good to get feedback from people who helped design the original fastboot manifest. Does it do more things that I'm not thinking of here?

@bobisjan
Copy link
Contributor

This is still happening with 0.16.1 and https://github.com/ef4/fastboot/compare/html-entrypoint.

The curious thing is that application boots in browser, the source code is provided by webpack://.

@NullVoxPopuli
Copy link
Collaborator

is this still happening? 😅

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

4 participants