You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+42-8Lines changed: 42 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -33,14 +33,6 @@ ember install ember-cli-fastboot
33
33
*`ember fastboot --serve-assets`
34
34
* Visit your app at `http://localhost:3000`.
35
35
36
-
### With `ember-cli` version 2.12.0-beta.1 and above
37
-
If your app is running ember-cli v2.12.0-beta.1+, you can just use `ember serve` instead of `ember fastboot --serve-assets` and visit at `http://localhost:4200/`.
38
-
39
-
Optionally you can even disable the fastboot serving at runtime using the `fastboot` query parameter. Example to turn off fastboot serving,
40
-
visit your app at `http://localhost:4200/?fastboot=false`. If you want to turn on fastboot serving again, simply visit at `http://localhost:4200/?fastboot=true` or `http://localhost:4200/`.
41
-
42
-
You can even disable serving fastboot with `ember serve` using an environment flag: `FASTBOOT_DISABLED=true ember serve`. If you have disabled building fastboot assets using the same flag as described [here](https://github.com/ember-fastboot/ember-cli-fastboot#double-build-times-and-no-incremental-builds), remember to also disable serving fastboot assets when using `ember serve`.
43
-
44
36
You may be shocked to learn that minified code runs faster in Node than
45
37
non-minified code, so you will probably want to run the production
46
38
environment build for anything "serious."
@@ -57,6 +49,14 @@ ember fastboot --port 8088
57
49
58
50
See `ember help fastboot` for more.
59
51
52
+
### With `ember-cli` version 2.12.0-beta.1 and above
53
+
If your app is running ember-cli v2.12.0-beta.1+, you can just use `ember serve` instead of `ember fastboot --serve-assets` and visit at `http://localhost:4200/`.
54
+
55
+
Optionally you can even disable the fastboot serving at runtime using the `fastboot` query parameter. Example to turn off fastboot serving,
56
+
visit your app at `http://localhost:4200/?fastboot=false`. If you want to turn on fastboot serving again, simply visit at `http://localhost:4200/?fastboot=true` or `http://localhost:4200/`.
57
+
58
+
You can even disable serving fastboot with `ember serve` using an environment flag: `FASTBOOT_DISABLED=true ember serve`. If you have disabled building fastboot assets using the same flag as described [here](https://github.com/ember-fastboot/ember-cli-fastboot#double-build-times-and-no-incremental-builds), remember to also disable serving fastboot assets when using `ember serve`.
59
+
60
60
## Using Node/npm Dependencies
61
61
62
62
### Whitelisting Packages
@@ -365,6 +365,40 @@ if (!process.env.EMBER_CLI_FASTBOOT) {
365
365
}
366
366
```
367
367
368
+
*Note*: This is soon going to be deprecated. See [this issue](https://github.com/ember-fastboot/ember-cli-fastboot/issues/360).
369
+
370
+
## Loading additional assets in FastBoot environment
371
+
372
+
Often addons require to load libraries that are specific to the FastBoot environment and only need to be loaded on the server side. This can include loading
373
+
libraries before or after the vendor file is loaded in the sandbox and/or before or after the app file is loaded in the sandbox. Since the FastBoot manifest defines
374
+
an array of vendor and app files to load in the sandbox, an addon can define additional vendor/app files to load in the sandbox as well.
375
+
376
+
If your addon requires to load something in the sandbox: you can define the `updateFastBootManifest` hook from your addon (in `index.js`):
377
+
378
+
```js
379
+
updateFastBootManifest(manifest) {
380
+
/**
381
+
* manifest is an object containing:
382
+
* {
383
+
* vendorFiles: [<path of the vendor file to load>, ...],
384
+
* appFiles: [<path of the app file to load>, ...],
385
+
* htmlFile: '<path of the base page that should be served by FastBoot>'
386
+
* }
387
+
*/
388
+
389
+
// This will load the foo.js before vendor.js is loaded in sandbox
390
+
manifest.vendorFiles.unshift('<path to foo.js under dist>');
391
+
// This will load bar.js after app.js is loaded in the sandbox
392
+
manifest.appFiles.push('<path to bar.js under dist>');
393
+
394
+
// remember to return the updated manifest, otherwise your build will fail.
395
+
return manifest;
396
+
}
397
+
```
398
+
399
+
*Note*: `process.env.EMBER_CLI_FASTBOOT` is soon going to be deprecated and [eventually removed](https://github.com/ember-fastboot/ember-cli-fastboot/issues/360).
400
+
Therefore, if you are relying on this environment variable to import something in the fastboot environment, you should instead use `updateFastBootManifest` hook.
0 commit comments