Update 10-exporting.md

This commit is contained in:
Rich Harris
2019-05-04 10:58:26 -04:00
committed by GitHub
parent 2754ba0ee4
commit 49f8b2c4bd

View File

@@ -44,7 +44,7 @@ You can also add a script to your package.json...
When you run `sapper export`, Sapper first builds a production version of your app, as though you had run `sapper build`, and copies the contents of your `assets` folder to the destination. It then starts the server, and navigates to the root of your app. From there, it follows any `<a>` elements it finds, and captures any data served by the app.
Because of this, any pages you want to be included in the exported site must be reachable by `<a>` elements. Additionally, any non-page routes should be requested in `preload`, *not* in `oncreate` or elsewhere.
Because of this, any pages you want to be included in the exported site must be reachable by `<a>` elements. Additionally, any non-page routes should be requested in `preload`, *not* in `onMount` or elsewhere.
### When not to export
@@ -60,4 +60,4 @@ Because `sapper export` writes to the filesystem, it isn't possible to have two
The solution is to rename one of the routes to avoid conflict — for example, `src/routes/foo-bar.js`. (Note that you would also need to update any code that fetches data from `/foo/bar` to reference `/foo-bar` instead.)
For *pages*, we skirt around this problem by writing `export/foo/index.html` instead of `export/foo`.
For *pages*, we skirt around this problem by writing `export/foo/index.html` instead of `export/foo`.