Skip to content

Commit

Permalink
docs: add note for applying baseAssets only to production (closes #1794)
Browse files Browse the repository at this point in the history
  • Loading branch information
brillout committed Aug 9, 2024
1 parent 3bd0c7c commit 938deb0
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions docs/pages/base-url/+Page.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,24 @@ Note how the Base URL of the URL of your pages isn't changed: your website is st
Example:
- <RepoLink path='/examples/base-url-cdn/' />
By default, the `baseAssets` setting applies to both development and production. You can apply it only to production by using `process.env.NODE_ENV`:
```js
// vite.config.js
import vike from 'vike/plugin'
const isProduction = process.env.NODE_ENV === 'production'
const baseAssets = isProduction ? 'https://cdn.example.org/my-website-assets/' : undefined
export default {
plugins: [
vike({ baseAssets })
]
}
```
> There is [work-in-progress to apply it only in production by default](https://github.com/vikejs/vike/issues/1794).
## `baseServer`
Expand Down

0 comments on commit 938deb0

Please sign in to comment.