Skip to content

Commit

Permalink
docs: improve instruction for backend integration, close #7778 (#8103)
Browse files Browse the repository at this point in the history
Co-authored-by: Enzo Innocenzi <enzo@innocenzi.dev>
  • Loading branch information
Zehua-Chen and innocenzi committed May 10, 2022
1 parent b2c029a commit 1be4646
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/guide/backend-integration.md
Expand Up @@ -36,7 +36,12 @@ If you need a custom integration, you can follow the steps in this guide to conf
<script type="module" src="http://localhost:3000/main.js"></script>
```

Also make sure the server is configured to serve static assets in the Vite working directory, otherwise assets such as images won't be loaded properly.
In order to properly serve assets, you have two options:

- Make sure the server is configured to proxy static assets requests to the Vite server
- Set [`server.origin`](https://vitejs.dev/config/#server-origin) so that generated asset URLs will be resolved using the back-end server URL instead of a relative path

This is needed for assets such as images to load properly.

Note if you are using React with `@vitejs/plugin-react`, you'll also need to add this before the above scripts, since the plugin is not able to modify the HTML you are serving:

Expand Down

0 comments on commit 1be4646

Please sign in to comment.