v1.0.7
Runtime change. dist/ differs from 1.0.6: the four decorators no longer carry
a reflect-metadata side-effect import, so the built bundle no longer references the
package at all.
Fixed
-
The application owns the
reflect-metadatapolyfill.@Processor,@Process,
@OnWorkerEventand@OnQueueEventeach imported it for its side effect. None of
the other eight@bymax-onelibraries does — the polyfill is global state the
application initialises once inmain.ts, and NestJS pulls it in regardless:
importing@nestjs/commonalone takesReflect.defineMetadatafromundefinedto
function. Nothing here needed to load it.Carrying it also contradicted this package's own
"sideEffects": false, which
asserts that no module has a side effect while importing something whose entire
purpose is one.The cost was measurable in a consumer's bundle: with the import present, esbuild
inlines the polyfill, taking a minimal bundle from 53 kB to 95 kB even when the
application had already loaded it.Nothing changes for a correctly wired application. The decorators are reachable
only through the.subpath, whose bundle imports@nestjs/commonon its first
line — so the polyfill is present before any decorator body runs, which the tests
and a real consumer both confirm.
Changed
- The Quick Start shows the
main.tsentry point, withimport 'reflect-metadata'
as its first line, and the peer matrix states plainly that the polyfill belongs to
the application. Previously the README namedreflect-metadataonly as a peer, which
was survivable while the library loaded it and is not now.