diff --git a/config/build-options.md b/config/build-options.md index 88f8bc6c..82e606aa 100644 --- a/config/build-options.md +++ b/config/build-options.md @@ -223,6 +223,30 @@ export default defineConfig({ ] ``` +::: tip + +如果你想在构建后的代码中引用许可文件,可以使用 `build.rolldownOptions.output.postBanner` 在文件顶部注入注释。例如: + + + +```js twoslash [vite.config.js] +import { defineConfig } from 'vite' + +export default defineConfig({ + build: { + license: true, + rolldownOptions: { + output: { + postBanner: + '/* See licenses of bundled dependencies at https://example.com/license.md */', + }, + }, + }, +}) +``` + +::: + ## build.manifest {#build-manifest} - **类型:** `boolean | string`