You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/generators/web/README.md
+53-92Lines changed: 53 additions & 92 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,27 +1,29 @@
1
1
# `web` Generator
2
2
3
-
The `web` generator transforms JSX AST entries into complete web bundles, producing server-side rendered HTML pages, client-side JavaScript with code splitting, and bundled CSS styles.
3
+
The `web` generator transforms JSX AST entries into complete web bundles. Vite
4
+
builds server-rendered HTML and hashed client-side JavaScript, CSS, and imported
5
+
assets. When `output` is configured, the client output also includes
6
+
`.vite/manifest.json` and `importmap.json`.
4
7
5
8
## Configuring
6
9
7
10
The `web` generator accepts the following configuration options:
|`output`|`string`| - | The directory where HTML, JavaScript, and CSS files will be written |
12
-
|`templatePath`|`string`|`'template.html'`| Path to the HTML template file |
13
-
|`project`|`string`|`'Node.js'`| Project name used in page titles and the version selector |
14
-
|`title`|`string`|`'{project} v{version} Documentation'`| Title template for HTML pages (supports `{project}`, `{version}`) |
15
-
|`useAbsoluteURLs`|`boolean`|`false`| When `true`, all internal links use absolute URLs based on `baseURL`|
16
-
|`editURL`|`string`|`'${GITHUB_EDIT_URL}/doc/api{path}.md'`| URL template for "edit this page" links |
17
-
|`pageURL`|`string`|`'{baseURL}/latest-{version}/api{path}.html'`| URL template for documentation page links |
18
-
|`remoteConfigUrl`|`string`|`'https://nodejs.org/site.json'`| URL fetched client-side at runtime for remote site config (currently used to power the announcement banner) |
19
-
|`head`|`object`| See below | Configurable `<meta>`, `<link>`, and raw markup for the document head |
20
-
|`lightningcss`|`object`|`{}`| Options spread into LightningCSS while bundling CSS (see below) |
21
-
|`imports`|`object`| See below | Object mapping `#theme/` aliases to component paths for customization |
22
-
|`virtualImports`|`object`|`{}`| Additional virtual module mappings merged into the build |
23
-
|`components`|`object`|`{}`| Maps JSX tag names to component imports, enabling JSX-in-MDX (see below) |
24
-
|`rolldown`|`object`|`{}`| Options merged into the Rolldown build — extra plugins, etc. (see below) |
|`output`|`string`| - | The directory where HTML and Vite's hashed client output will be written |
15
+
|`templatePath`|`string`|`'template.html'`| Path to the HTML template file |
16
+
|`project`|`string`|`'Node.js'`| Project name used in page titles and the version selector |
17
+
|`title`|`string`|`'{project} v{version} Documentation'`| Title template for HTML pages (supports `{project}`, `{version}`) |
18
+
|`useAbsoluteURLs`|`boolean`|`false`| When `true`, all internal links use absolute URLs based on `baseURL`|
19
+
|`editURL`|`string`|`'${GITHUB_EDIT_URL}/doc/api{path}.md'`| URL template for "edit this page" links |
20
+
|`pageURL`|`string`|`'{baseURL}/latest-{version}/api{path}.html'`| URL template for documentation page links |
21
+
|`remoteConfigUrl`|`string`|`'https://nodejs.org/site.json'`| URL fetched client-side at runtime for remote site config (currently used to power the announcement banner) |
22
+
|`head`|`object`| See below | Configurable `<meta>`, `<link>`, and raw markup for the document head |
23
+
|`imports`|`object`| See below | Object mapping `#theme/` aliases to component paths for customization |
24
+
|`virtualImports`|`object`|`{}`| Additional virtual module mappings merged into both Vite builds |
25
+
|`components`|`object`|`{}`| Maps JSX tag names to component imports, enabling JSX-in-MDX (see below) |
26
+
|`vite`|`UserConfig`|`{}`| Vite configuration merged into the client and SSR builds (see below) |
25
27
26
28
### `head`
27
29
@@ -67,93 +69,51 @@ export default {
67
69
> via `head`: `og:title` (mirrors the per-page title), `og:type`, and the font
68
70
> preconnects/stylesheet the bundled UI components rely on.
69
71
70
-
### Custom LightningCSS options
72
+
### Custom Vite options
71
73
72
-
The `lightningcss` object is spread directly into [LightningCSS][lightningcss]
73
-
while CSS is bundled, so any of its options — `visitor` (custom plugins),
74
-
`customAtRules`, `targets`, `drafts`, and so on — are supported. The generator
75
-
manages `filename`, `code`, `cssModules`, and `resolver`, so those are ignored.
74
+
The `vite` object is merged into both production builds. This supports Vite
75
+
plugins, aliases, `define`, asset options, and native Lightning CSS settings.
76
+
Use `import.meta.env.SSR` inside application code or plugin transforms when
77
+
behavior must differ between the SSR and browser builds.
0 commit comments