Skip to content

Commit fb8cd1a

Browse files
benmccannhabibrosyad
authored andcommitted
Add docs for --legacy flag (sveltejs#1209)
1 parent 91443cf commit fb8cd1a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

site/content/docs/09-building.md

+18-1
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,21 @@ The output is a Node app that you can run from the project root:
1212

1313
```bash
1414
node __sapper__/build
15-
```
15+
```
16+
17+
### Browser support
18+
19+
Your site is built only for the latest versions of modern evergreen browsers by default. If you are using Rollup, you can use the `--legacy`[1] flag to build a second bundle that can be used to support legacy browsers like Internet Explorer. Sapper will then serve up the correct bundle at runtime[2].
20+
21+
When using `--legacy`, Sapper will pass an environment variable `SAPPER_LEGACY_BUILD` to your Rollup config. Sapper will then build your client-side bundle twice: once with `SAPPER_LEGACY_BUILD` set to `true` and once with it set to `false`. [sapper-template-rollup](https://github.com/sveltejs/sapper-template-rollup) provides an example of utilizing this configuration.[3]
22+
23+
You may wish to add this flag to a script in your `package.json`:
24+
```
25+
"scripts": {
26+
"build": "sapper build --legacy",
27+
},
28+
```
29+
30+
[1] This option is unrelated to Svelte's `legacy` option
31+
[2] Browsers which do not support `async/await` syntax will be served the legacy bundle
32+
[3] You will also need to polyfill APIs that are not present in older browsers.

0 commit comments

Comments
 (0)