diff --git a/website/docs/en/config/dev/asset-prefix.mdx b/website/docs/en/config/dev/asset-prefix.mdx index 468827f99b..41ab2abd9a 100644 --- a/website/docs/en/config/dev/asset-prefix.mdx +++ b/website/docs/en/config/dev/asset-prefix.mdx @@ -17,7 +17,7 @@ When `server.base` is `/foo`, `index.html` and other static assets can be access It should be noted that when customizing the `dev.assetPrefix` option, if you want static assets to be normally accessible through the Rsbuild dev server, `dev.assetPrefix` should contain the same URL prefix as `server.base`. For example: -```ts +```ts title="rsbuild.config.ts" export default { dev: { assetPrefix: '/foo/bar/', diff --git a/website/docs/en/config/dev/hmr.mdx b/website/docs/en/config/dev/hmr.mdx index bcb2ff6683..57509848fb 100644 --- a/website/docs/en/config/dev/hmr.mdx +++ b/website/docs/en/config/dev/hmr.mdx @@ -13,7 +13,7 @@ Refer to [Hot Module Replacement](/guide/advanced/hmr) for more information. When `dev.hmr` is set to `false`, HMR and react-refresh will be disabled and Rsbuild will automatically fall back to [dev.liveReload](/config/dev/live-reload). -```js +```ts title="rsbuild.config.ts" export default { dev: { hmr: false, diff --git a/website/docs/en/config/dev/live-reload.mdx b/website/docs/en/config/dev/live-reload.mdx index 870640ceaa..3693bd8147 100644 --- a/website/docs/en/config/dev/live-reload.mdx +++ b/website/docs/en/config/dev/live-reload.mdx @@ -13,7 +13,7 @@ Please refer to [Hot Module Replacement](/guide/advanced/hmr) for more informati To disable live reload, set both `dev.hmr` and `dev.liveReload` to `false`. Then, no WebSocket requests will be made to the dev server on the page, and the page will not automatically refresh when files change. -```js +```ts title="rsbuild.config.ts" export default { dev: { hmr: false, diff --git a/website/docs/en/config/dev/watch-files.mdx b/website/docs/en/config/dev/watch-files.mdx index f92935a2df..572cc3ab4b 100644 --- a/website/docs/en/config/dev/watch-files.mdx +++ b/website/docs/en/config/dev/watch-files.mdx @@ -26,7 +26,7 @@ Paths of the files or directories to watch, supports glob syntax. It can be a si - Watching a single file: -```js +```ts title="rsbuild.config.ts" export default { dev: { watchFiles: { @@ -38,7 +38,7 @@ export default { - Using glob to match multiple files: -```js +```ts title="rsbuild.config.ts" export default { dev: { watchFiles: { @@ -50,7 +50,7 @@ export default { - Watching multiple file paths: -```js +```ts title="rsbuild.config.ts" export default { dev: { watchFiles: { @@ -73,7 +73,7 @@ Specifies whether to trigger a page reload or restart the dev server when a file This can be used to watch changes to static assets, such as files in the `public` directory. -```js +```ts title="rsbuild.config.ts" export default { dev: { watchFiles: { @@ -115,7 +115,7 @@ Note that the reload-server functionality is provided by Rsbuild CLI. If you are `watchFiles` is implemented based on [chokidar v4](https://github.com/paulmillr/chokidar#api), and you can pass chokidar options through `options`. -```js +```ts title="rsbuild.config.ts" export default { dev: { watchFiles: { diff --git a/website/docs/en/config/dev/write-to-disk.mdx b/website/docs/en/config/dev/write-to-disk.mdx index 9027d9f75e..4a8c425ab0 100644 --- a/website/docs/en/config/dev/write-to-disk.mdx +++ b/website/docs/en/config/dev/write-to-disk.mdx @@ -15,7 +15,7 @@ You can choose to write the build output to disk, which is usually used for insp Simply set the `dev.writeToDisk` option to `true`: -```ts +```ts title="rsbuild.config.ts" export default { dev: { writeToDisk: true, @@ -33,7 +33,7 @@ You can also set `dev.writeToDisk` to a function to match only certain files. Wh For example, to write files to disk while excluding hot-update temporary files: -```ts +```ts title="rsbuild.config.ts" export default { dev: { writeToDisk: (file) => !file.includes('.hot-update.'), diff --git a/website/docs/en/config/environments.mdx b/website/docs/en/config/environments.mdx index eaba8c92c7..0708df545c 100644 --- a/website/docs/en/config/environments.mdx +++ b/website/docs/en/config/environments.mdx @@ -135,7 +135,7 @@ const nodeConfig = { Since environment names are used in directory names and object property names, we recommend using only letters, numbers, `-`, `_`, and `$`. When other characters are used, Rsbuild will show a warning. -```ts +```ts title="rsbuild.config.ts" export default { environments: { someName: {}, // ✅ diff --git a/website/docs/en/config/html/app-icon.mdx b/website/docs/en/config/html/app-icon.mdx index 3195803ca3..13bd7aa74c 100644 --- a/website/docs/en/config/html/app-icon.mdx +++ b/website/docs/en/config/html/app-icon.mdx @@ -39,7 +39,7 @@ For display on different devices, you will need to prepare several icons of diff The most commonly used icon sizes are `192x192` and `512x512`, and you can customize the icon sizes and quantities to suit your needs. -```js +```ts title="rsbuild.config.ts" export default { html: { appIcon: { @@ -131,7 +131,7 @@ export default { Use `target` to specify the target for the icon: -```js +```ts title="rsbuild.config.ts" export default { html: { appIcon: { @@ -165,7 +165,7 @@ export default { The filename of the manifest file. -```js +```ts title="rsbuild.config.ts" export default { html: { appIcon: { diff --git a/website/docs/en/config/html/crossorigin.mdx b/website/docs/en/config/html/crossorigin.mdx index c583f077df..77cb4fe086 100644 --- a/website/docs/en/config/html/crossorigin.mdx +++ b/website/docs/en/config/html/crossorigin.mdx @@ -10,7 +10,7 @@ Set the [crossorigin](https://developer.mozilla.org/en-US/docs/Web/HTML/Attribut ## Example -```js +```ts title="rsbuild.config.ts" export default { html: { crossorigin: 'anonymous', diff --git a/website/docs/en/config/html/favicon.mdx b/website/docs/en/config/html/favicon.mdx index be4cc61aff..ebdbaba5e1 100644 --- a/website/docs/en/config/html/favicon.mdx +++ b/website/docs/en/config/html/favicon.mdx @@ -19,7 +19,7 @@ Rsbuild also provides [html.appIcon](/config/html/app-icon) to set the icon of t Set as a relative path: -```js +```ts title="rsbuild.config.ts" export default { html: { favicon: './src/assets/icon.png', @@ -92,7 +92,7 @@ When `html.favicon` is of type Function, the function receives an object as inpu In the context of MPA (Multi-Page Application), you can return different `favicon` based on the entry name, thus generating different tags for each page: -```js +```ts title="rsbuild.config.ts" export default { html: { favicon({ entryName }) { diff --git a/website/docs/en/config/html/inject.mdx b/website/docs/en/config/html/inject.mdx index 6a61ceac5a..513a534e08 100644 --- a/website/docs/en/config/html/inject.mdx +++ b/website/docs/en/config/html/inject.mdx @@ -34,7 +34,7 @@ The `