-
Notifications
You must be signed in to change notification settings - Fork 0
docs: complete build command guide #54
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,45 @@ | ||
| # build | ||
|
|
||
| TODO. | ||
| The `rs build` command uses [Rsbuild](https://rsbuild.rs/guide/basic/cli#rsbuild-build) to build an application for production. | ||
|
|
||
| ## Usage | ||
|
|
||
| ```bash | ||
| rs build [options] | ||
| ``` | ||
|
|
||
| The command loads the application configuration registered with [`define.app()`](../configuration#define-app). | ||
|
|
||
| ## Options | ||
|
|
||
| `rs build` supports the same build options as Rsbuild. See the [Rsbuild CLI documentation](https://rsbuild.rs/guide/basic/cli#rsbuild-build) for details. | ||
|
|
||
| Examples: | ||
|
|
||
| ```bash | ||
| # Write output files to the output directory | ||
| rs build --dist-path output | ||
|
|
||
| # Generate source maps for the output files | ||
| rs build --source-map | ||
|
|
||
| # Rebuild when files change | ||
| rs build --watch | ||
| ``` | ||
|
|
||
| ## Configuration | ||
|
|
||
| See [`define.app()`](../configuration#define-app). | ||
| Configure the production build through [`define.app()`](../configuration#define-app) in the [Rstack configuration file](/guide/configuration#configuration-file). It accepts the standard [Rsbuild configuration](https://rsbuild.rs/config/): | ||
|
|
||
| ```ts title="rstack.config.ts" | ||
| import { define } from 'rstack'; | ||
|
|
||
| define.app({ | ||
| output: { | ||
| distPath: { | ||
| root: 'output', | ||
| }, | ||
| sourceMap: true, | ||
| }, | ||
| }); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,45 @@ | ||
| # build | ||
|
|
||
| TODO. | ||
| `rs build` 命令使用 [Rsbuild](https://rsbuild.rs/zh/guide/basic/cli#rsbuild-build) 构建应用的生产版本。 | ||
|
|
||
| ## 用法 \{#usage} | ||
|
|
||
| ```bash | ||
| rs build [options] | ||
| ``` | ||
|
|
||
| 该命令会加载通过 [`define.app()`](../configuration#define-app) 注册的应用配置。 | ||
|
|
||
| ## 选项 \{#options} | ||
|
|
||
| `rs build` 支持与 Rsbuild 相同的构建选项,具体说明请参见 [Rsbuild CLI 文档](https://rsbuild.rs/zh/guide/basic/cli#rsbuild-build)。 | ||
|
|
||
| 示例: | ||
|
|
||
| ```bash | ||
| # 将构建产物写入 output 目录 | ||
| rs build --dist-path output | ||
|
|
||
| # 为构建产物生成 source map | ||
| rs build --source-map | ||
|
|
||
| # 在文件变化时重新构建 | ||
| rs build --watch | ||
| ``` | ||
|
|
||
| ## 配置 \{#configuration} | ||
|
|
||
| 参见 [`define.app()`](../configuration#define-app)。 | ||
| 在 [Rstack 配置文件](/guide/configuration#configuration-file)中通过 [`define.app()`](../configuration#define-app) 配置生产构建。该 API 支持标准的 [Rsbuild 配置](https://rsbuild.rs/zh/config/): | ||
|
|
||
| ```ts title="rstack.config.ts" | ||
| import { define } from 'rstack'; | ||
|
|
||
| define.app({ | ||
| output: { | ||
| distPath: { | ||
| root: 'output', | ||
| }, | ||
| sourceMap: true, | ||
| }, | ||
| }); | ||
| ``` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.