Skip to content

Commit f0322b5

Browse files
committed
docs(features): add license section
1 parent e687eb1 commit f0322b5

File tree

2 files changed

+39
-20
lines changed

2 files changed

+39
-20
lines changed

config/build-options.md

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -189,28 +189,11 @@ export default defineConfig({
189189

190190
- **型:** `boolean | { fileName?: string }`
191191
- **デフォルト:** `false`
192+
- **関連:** [License](/guide/features#license)
192193

193-
`true` に設定すると、ビルドによってバンドルされたすべての依存関係のライセンスを含む `.vite/license.md` ファイルが生成されます。これをホストして、アプリで使用されている依存関係を表示および承認できます。`fileName` を渡すと、`outDir` からの相対パスでライセンスファイル名として使用されます。出力例は次のようになります:
194+
`true` に設定すると、ビルドによってバンドルされたすべての依存関係のライセンスを含む `.vite/license.md` ファイルが生成されます。
194195

195-
```md
196-
# Licenses
197-
198-
The app bundles dependencies which contain the following licenses:
199-
200-
## dep-1 - 1.2.3 (CC0-1.0)
201-
202-
CC0 1.0 Universal
203-
204-
...
205-
206-
## dep-2 - 4.5.6 (MIT)
207-
208-
MIT License
209-
210-
...
211-
```
212-
213-
`fileName``.json` で終わる場合、代わりに生の JSON メタデータが生成され、さらなる処理に使用できます。たとえば:
196+
`fileName` を渡すと、`outDir` からの相対パスでライセンスファイル名として使用されます。これが `.json` で終わる場合、代わりに生の JSON メタデータが生成され、さらなる処理に使用できます。たとえば:
214197

215198
```json
216199
[

guide/features.md

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -789,6 +789,42 @@ CSP をデプロイするには、Vite 内部の理由により、特定のデ
789789
[`script-src`](https://developer.mozilla.org/ja/docs/Web/HTTP/Headers/Content-Security-Policy/script-src) に対して `data:` を許可してはいけません。任意のスクリプトのインジェクションを許してしまうことになります。
790790
:::
791791

792+
## License
793+
794+
Vite は [`build.license`](/config/build-options.md#build-license) オプションを使用して、ビルドで使用されるすべての依存関係のライセンスのファイルを生成できます。これをホストして、アプリで使用されている依存関係を表示および承認できます。
795+
796+
```js twoslash [vite.config.js]
797+
import { defineConfig } from 'vite'
798+
799+
export default defineConfig({
800+
build: {
801+
license: true,
802+
},
803+
})
804+
```
805+
806+
これにより、次のような出力の `.vite/license.md` ファイルが生成されます:
807+
808+
```md
809+
# Licenses
810+
811+
The app bundles dependencies which contain the following licenses:
812+
813+
## dep-1 - 1.2.3 (CC0-1.0)
814+
815+
CC0 1.0 Universal
816+
817+
...
818+
819+
## dep-2 - 4.5.6 (MIT)
820+
821+
MIT License
822+
823+
...
824+
```
825+
826+
異なるパスでファイルを提供するには、たとえば `{ fileName: 'license.md' }` を渡すことで、`https://example.com/license.md` で提供されるようになります。詳細については、[`build.license`](/config/build-options.md#build-license) ドキュメントを参照してください。
827+
792828
## ビルドの最適化 {#build-optimizations}
793829

794830
> 以下にリストされている機能は、ビルドプロセスの一部として自動的に適用され、無効にする場合を除いて、明示的に設定する必要はありません。

0 commit comments

Comments
 (0)