Skip to content

Commit 468d0c3

Browse files
committed
feat: add docs about rspack
1 parent 81e869f commit 468d0c3

26 files changed

Lines changed: 431 additions & 14 deletions

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
"prefetch",
3434
"preload",
3535
"prismjs",
36+
"rspack",
3637
"shiki",
3738
"shikiji",
3839
"slugify",

docs/.vuepress/config.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { createRequire } from 'node:module'
22
import process from 'node:process'
33

4+
import { rspackBundler } from '@vuepress/bundler-rspack'
45
import { viteBundler } from '@vuepress/bundler-vite'
56
import { webpackBundler } from '@vuepress/bundler-webpack'
67
import { docsearchPlugin } from '@vuepress/plugin-docsearch'
@@ -22,6 +23,9 @@ import {
2223
const __dirname = getDirname(import.meta.url)
2324
const require = createRequire(import.meta.url)
2425
const isProd = process.env.NODE_ENV === 'production'
26+
const isWebpackOrRspack =
27+
process.env.DOCS_BUNDLER === 'webpack' ||
28+
process.env.DOCS_BUNDLER === 'rspack'
2529

2630
export default defineUserConfig({
2731
// set site base to default value
@@ -46,7 +50,11 @@ export default defineUserConfig({
4650

4751
// specify bundler via environment variable
4852
bundler:
49-
process.env.DOCS_BUNDLER === 'webpack' ? webpackBundler() : viteBundler(),
53+
process.env.DOCS_BUNDLER === 'webpack'
54+
? webpackBundler()
55+
: process.env.DOCS_BUNDLER === 'rspack'
56+
? rspackBundler()
57+
: viteBundler(),
5058

5159
// configure default theme
5260
theme: defaultTheme({
@@ -117,6 +125,13 @@ export default defineUserConfig({
117125

118126
// configure markdown
119127
markdown: {
128+
...(isWebpackOrRspack
129+
? {
130+
assets: {
131+
absolutePathPrependBase: true,
132+
},
133+
}
134+
: {}),
120135
importCode: {
121136
handleImportPath: (importPath) => {
122137
// handle @vuepress packages import path

docs/.vuepress/configs/navbar/en.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export const navbarEn: NavbarOptions = [
4545
children: [
4646
'/reference/bundler/vite.md',
4747
'/reference/bundler/webpack.md',
48+
'/reference/bundler/rspack.md',
4849
],
4950
},
5051
{

docs/.vuepress/configs/navbar/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ export const navbarZh: NavbarOptions = [
4242
children: [
4343
'/zh/reference/bundler/vite.md',
4444
'/zh/reference/bundler/webpack.md',
45+
'/zh/reference/bundler/rspack.md',
4546
],
4647
},
4748
{

docs/.vuepress/configs/sidebar/en.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ export const sidebarEn: SidebarOptions = {
6060
},
6161
{
6262
text: 'Bundlers',
63-
children: ['/reference/bundler/vite.md', '/reference/bundler/webpack.md'],
63+
children: [
64+
'/reference/bundler/vite.md',
65+
'/reference/bundler/webpack.md',
66+
'/reference/bundler/rspack.md',
67+
],
6468
},
6569
{
6670
text: 'Ecosystem',

docs/.vuepress/configs/sidebar/zh.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export const sidebarZh: SidebarOptions = {
6363
children: [
6464
'/zh/reference/bundler/vite.md',
6565
'/zh/reference/bundler/webpack.md',
66+
'/zh/reference/bundler/rspack.md',
6667
],
6768
},
6869
{

docs/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ features:
2828
details: Flexible plugin API, allowing plugins to provide lots of plug-and-play features for your site.
2929

3030
- title: Bundlers
31-
details: Recommended bundler is Vite, while Webpack is also supported. Choose the one you like!
31+
details: Recommended bundler is Vite, while Webpack and Rspack are also supported. Choose the one you like!
3232

3333
footer: MIT Licensed | Copyright © 2018-present VuePress Community
3434
---

docs/guide/assets.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ In most cases, you don't need to worry about the reference path of those public
6565
```
6666

6767
::: tip
68-
When using [webpack bundler](../reference/bundler/webpack.md), you need to set [markdown.assets.absolutePathPrependBase](../reference/config.md#markdown-assets) to `true` to automatically prepend base to markdown images.
68+
When using [webpack bundler](../reference/bundler/webpack.md) or [rspack bundler](../reference/bundler/rspack.md), you need to set [markdown.assets.absolutePathPrependBase](../reference/config.md#markdown-assets) to `true` to automatically prepend base to markdown images.
6969
:::
7070

7171
However, sometimes you may have some dynamical links referencing public files, especially when you are authoring a custom theme. In such case, the `base` could not be handled automatically. To help with that, VuePress provides a [withBase](../reference/client-api.md#withbase) helper to prepend `base` for you:

docs/guide/bundler.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Bundler
22

3-
VuePress supports using [Webpack](https://webpack.js.org/) or [Vite](https://vite.dev/) to dev and build sites. You can choose which bundler to use according to your preference, and no extra configuration is required.
3+
VuePress supports using [Vite](https://vite.dev/), [Webpack](https://webpack.js.org/), or [Rspack](https://rspack.dev/) to dev and build sites. You can choose which bundler to use according to your preference, and no extra configuration is required.
44

55
## Install a Bundler
66

@@ -15,6 +15,8 @@ When installing the [vuepress](https://www.npmjs.com/package/vuepress) package,
1515
pnpm add -D vuepress@next @vuepress/bundler-vite@next
1616
# install webpack bundler
1717
pnpm add -D vuepress@next @vuepress/bundler-webpack@next
18+
# install rspack bundler
19+
pnpm add -D vuepress@next @vuepress/bundler-rspack@next
1820
```
1921

2022
@tab yarn
@@ -24,6 +26,8 @@ pnpm add -D vuepress@next @vuepress/bundler-webpack@next
2426
yarn add -D vuepress@next @vuepress/bundler-vite@next
2527
# install webpack bundler
2628
yarn add -D vuepress@next @vuepress/bundler-webpack@next
29+
# install rspack bundler
30+
yarn add -D vuepress@next @vuepress/bundler-rspack@next
2731
```
2832

2933
@tab npm
@@ -33,6 +37,8 @@ yarn add -D vuepress@next @vuepress/bundler-webpack@next
3337
npm install -D vuepress@next @vuepress/bundler-vite@next
3438
# install webpack bundler
3539
npm install -D vuepress@next @vuepress/bundler-webpack@next
40+
# install rspack bundler
41+
npm install -D vuepress@next @vuepress/bundler-rspack@next
3642
```
3743

3844
:::
@@ -46,14 +52,17 @@ You can use a bundler via the [bundler](../reference/config.md#bundler) option:
4652
```ts
4753
import { viteBundler } from '@vuepress/bundler-vite'
4854
// import { webpackBundler } from '@vuepress/bundler-webpack'
55+
// import { rspackBundler } from '@vuepress/bundler-rspack'
4956

5057
export default {
5158
bundler: viteBundler(),
5259
// bundler: webpackBundler(),
60+
// bundler: rspackBundler(),
5361
}
5462
```
5563

5664
When you need to customize the bundler, you can set the corresponding options:
5765

5866
- [Bundlers > Vite](../reference/bundler/vite.md)
5967
- [Bundlers > Webpack](../reference/bundler/webpack.md)
68+
- [Bundlers > Rspack](../reference/bundler/rspack.md)

docs/guide/introduction.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ During build, we create a server-rendered version of the VuePress site and rende
1818

1919
VitePress can be seen as the younger sibling of VuePress. Both were originally created by Evan You, the author of Vue.js. Today, VitePress is maintained by the Vue.js team, while VuePress is maintained by the VuePress team.
2020

21-
The history goes like this: VuePress v0 and v1 were built on top of Webpack. Later, when Evan created Vite, he started a new static site generator based on it — VitePress — reusing some ideas and code from VuePress. At the same time, the community forked the VuePress v2 branch, continued its development, and added support for both Webpack and Vite.
21+
The history goes like this: VuePress v0 and v1 were built on top of Webpack. Later, when Evan created Vite, he started a new static site generator based on it — VitePress — reusing some ideas and code from VuePress. At the same time, the community forked the VuePress v2 branch, continued its development, and added support for Webpack, Vite, and Rspack.
2222

2323
At one point, we discussed merging the two projects under the VuePress brand. However, over time their goals and technical directions diverged. As a result, the Vue.js team chose to focus on VitePress, while the community — now the VuePress team — took over VuePress and continues to drive its development forward.
2424

25-
As a user, you can choose either project depending on your needs. VitePress is tightly integrated with Vite. VuePress, on the other hand, is designed to support different bundlers: it supports Webpack and Vite today, and open to any other bundlers. In addition, VuePress has an official [ecosystem](https://ecosystem.vuejs.press/) project and provides a wide range of plugins, making it easier to build sites with features.
25+
As a user, you can choose either project depending on your needs. VitePress is tightly integrated with Vite. VuePress, on the other hand, is designed to support different bundlers: it supports Vite, Webpack and Rspack today, and open to any other bundlers. In addition, VuePress has an official [ecosystem](https://ecosystem.vuejs.press/) project and provides a wide range of plugins, making it easier to build sites with features.

0 commit comments

Comments
 (0)