Skip to content

Conversation

@btea
Copy link
Contributor

@btea btea commented Nov 6, 2025

Keep it consistent with the default values ​​in the example code above.

@bluwy
Copy link
Member

bluwy commented Nov 6, 2025

The reason I didn't do this is because (iirc) most static providers don't serve dot directories by default. I also placed it in .vite/ by default so we don't collide with other output files by default (and I guess frameworks may easily handle it?)

I just sent a PR showing an example of setting "license.md" in the features page though. #21071

@btea
Copy link
Contributor Author

btea commented Nov 6, 2025

That makes sense.

I have another question: when I configure the banner as shown in the example below, the related comments don't appear in the actual output. It seems they've been removed by esbuild plugins. Is it possible to configure some options to retain the comments?

@bluwy
Copy link
Member

bluwy commented Nov 6, 2025

Ah, that's unexpected. Esbuild probably stripped them off when we run it on each output chunks, so probably you'd have to configure the banner on the esbuild option instead to workaround, but I wonder if we should like pass build.rollupOptions.output.banner to esbuild.banner to make it work.

It would be great if you open an issue about this.

@btea
Copy link
Contributor Author

btea commented Nov 6, 2025

Ah, that's unexpected. Esbuild probably stripped them off when we run it on each output chunks, so probably you'd have to configure the banner on the esbuild option instead to workaround, but I wonder if we should like pass build.rollupOptions.output.banner to esbuild.banner to make it work.

Yeah, that's what I think too.

It would be great if you open an issue about this.

#21076

@sapphi-red
Copy link
Member

I wonder if we should like pass build.rollupOptions.output.banner to esbuild.banner to make it work.

This will not work with rolldown-vite as esbuild.banner is removed and oxc.banner does not exist. It has to use generateBundle hook to inject code/comments after minification (related: rolldown/rolldown#6790).

@bluwy
Copy link
Member

bluwy commented Nov 7, 2025

This feels a bit tricky. Should we remove the tip for now since it's only showing an example setup? We probably should figure out better banner/footer support later with the new issue.

@btea
Copy link
Contributor Author

btea commented Nov 8, 2025

I agree that the relevant examples should be removed first.

@sapphi-red sapphi-red added the documentation Improvements or additions to documentation label Nov 8, 2025
@sapphi-red sapphi-red changed the title docs: update build.license example docs: remove broken build.license example Nov 8, 2025
Copy link
Member

@sapphi-red sapphi-red left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, let's remove this for now

@sapphi-red sapphi-red merged commit e1c43e0 into vitejs:main Nov 8, 2025
14 checks passed
@btea btea deleted the docs/update-build-license-example branch November 8, 2025 07:22
})
```

:::
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants