Collection Output Target
The collection output target contains your components' transpiled source, metadata, and build flags - not a bundle. It exists so a downstream Stencil project can re-compile and re-bundle your components with its own compiler, instead of treating your library as an opaque pre-built dependency the way loader-bundle/standalone are consumed.
It's always generated in production builds unless you configure one explicitly - there's nothing to add to outputTargets for the common case.
outputTargets: [
{
type: 'collection'
}
]
Formerly the dist-collection sub-output of dist in Stencil v4, now a first-class output target.
Modules in your srcDir keep their paths relative to it. Modules outside srcDir, such as shared source in a monorepo, go under _external/. See Share Code in a Monorepo.
構成
dir
default: dist/collection
Where the transpiled source and manifest are written.
empty
default: true
Setting this flag to false will keep the contents of dir between builds instead of emptying it first.