Does it work with webpack: true in nest-cli.json?
Yes, via the CLI plugin.
Answer
Yes: register nestjs-docfy in nest-cli.json's compilerOptions.plugins and call applyDocfyMetadata(document) right after SwaggerModule.createDocument(). This is the same mechanism @nestjs/swagger's own CLI plugin uses to work under webpack, and it fixes the underlying limitation at the root instead of working around it: runtime discovery (DocfyModule, without the plugin) still can't work, because it depends on require.cache and webpack inlines everything into a single bundle, never populating it with an entry per original source file. See The CLI plugin.
What about the SWC builder?
Yes, but it needs "typeCheck": true set alongside "builder": "swc" — under SWC, @nestjs/cli only invokes plugins through a different hook, gated on type-checking being on. Leave it out and the plugin quietly no-ops: the build still succeeds, just with no docfy-metadata.json written. Full explanation in the SWC builder section of the plugin guide.