platforms narrows it to the names your configuration defines.
string[] | { build?: string[]; watch?: string[] }
An array selects the same platforms for every build. The object form splits the first compile,
build, from the watch rebuilds, watch. An omitted key means every platform, so { watch: ['css'] } builds all of them once and then only css.serve key, throws a TypeError when the plugin is created.
What it saves
Measured on a six-platform configuration (css, scss, js, ios, android, flutter), timing the build call alone:Generated output is disposable
Nothing removes a generated file, ever. Drop afiles entry, remove a platform or move a buildPath, and the old output stays where it was, still importable, still carrying its old values, and in a package build still published.
So treat the build directory as disposable: delete it when a configuration changes shape, and keep it out of version control and away from hand-written files. Keep it out of the bundler’s own output directory too, since Vite empties build.outDir after the plugin has compiled.
There is deliberately no clean option. Style Dictionary’s cleanAllPlatforms() removes the destinations the current configuration declares, which are exactly the files that are not orphans, and the buildPath directory along with them.
