Skip to content

Commit

Permalink
More docs updated
Browse files Browse the repository at this point in the history
  • Loading branch information
ItalyPaleAle committed Dec 9, 2023
1 parent 02be8f4 commit 8f0cdc9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Advanced Usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ routes.set('/books', wrap({

### Async routes and loading placeholders

As mentioned in the main readme, starting with version 3 the `wrap` method is used with dynamically-imported components. This allows (when the bundler supports that, such as with Rollup or Webpack) code-splitting too, so code for less-common routes can be downloaded on-demand from the server rather than shipped in the app's core bundle.
As mentioned in the main readme, starting with version 3 the `wrap` method is used with dynamically-imported components. This allows (when the bundler supports that, such as with Vite, Rollup or Webpack) code-splitting too, so code for less-common routes can be downloaded on-demand from the server rather than shipped in the app's core bundle.

This is done by setting the `options.asyncComponent` property to a function that returns a dynamically-imported module. For example:

Expand Down
2 changes: 1 addition & 1 deletion examples/dynamic-imports/src/routes/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<p>
This sample shows how to dynamically import components. These are modules imported on-demand with the <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/import"><code>import()</code> method</a>.<br/>
Bundlers like Rollup and Webpack support automatic code splitting when you use dynamic imports, so after compiling this sample, in the <code>dist/</code> folder you'll see a bunch of different JavaScript files. At runtime, the browser requests them only when you first navigate to the route (and then they're cached).
Bundlers like Vite, Rollup and Webpack support automatic code splitting when you use dynamic imports, so after compiling this sample, in the <code>dist/</code> folder you'll see a bunch of different JavaScript files. At runtime, the browser requests them only when you first navigate to the route (and then they're cached).
</p>

<p>This is the Home component, which contains markup only.</p>
Expand Down

0 comments on commit 8f0cdc9

Please sign in to comment.