Skip to content

Commit 8ddfac2

Browse files
fi3eworkclaude
andauthored
docs(faq): add FAQ entries for subpath deployment and Template.toString() (#463)
Explain that `Template.toString()` displaying bundler-compiled output is expected behavior of `Function.prototype.toString()` and not specific to the Rsbuild builder. Link to Storybook's recommended alternatives (CSF 3 format, docs source parameters). Ref: #224 Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent fc43fb9 commit 8ddfac2

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

website/docs/guide/faq.mdx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,14 @@ const config: StorybookConfig = {
2020
}
2121
```
2222

23+
## `Template.toString()` shows compiled code in Docs source snippet
24+
25+
When using the CSF 2 `Template.bind({})` pattern and `Template.toString()` to display source code in the Docs addon, the snippet shows bundler-compiled output instead of your original source.
26+
27+
This is expected — `Function.prototype.toString()` serializes the **runtime** function, which has already been transformed by the bundler. This is not specific to the Rsbuild builder; the same happens with webpack and Vite.
28+
29+
Storybook recommends using the [CSF 3 format](https://storybook.js.org/docs/api/csf) with the automatic source snippet feature, or manually providing source code through [docs source parameters](https://storybook.js.org/docs/api/doc-blocks/doc-block-source). See the [Storybook Docs documentation](https://storybook.js.org/docs/writing-docs/autodocs) for more details.
30+
2331
## Build errors from unexpected files
2432

2533
> [!NOTE]

0 commit comments

Comments
 (0)