docs/package-metadata: document sideEffects field

Signed-off-by: Patrik Oldsberg <poldsberg@gmail.com>
This commit is contained in:
Patrik Oldsberg
2024-06-13 11:51:24 +02:00
parent 3ab55be3d8
commit 013449b98a
+6
View File
@@ -51,3 +51,9 @@ The exports of the package, as defined by [Node.js](https://nodejs.org/api/packa
This field is used to specify the type entry points for the package, the TypeScript equivalent of the `exports` field. TypeScript also supports defining this in the `exports` field, but that requires that the `moduleResolution` option in `tsconfig.json` is set to `node16` or `bundler`, which we currently do not support.
This field can be generated by the `backstage-cli repo fix` command. First fill out the `exports` field to point to source fields, which will then be used to generate the `typeVersions`.
### `sideEffects`
This field declares whether it is safe to remove unused code when bundling this package into a frontend build, and is defined for example by [WebPack](https://github.com/backstage/backstage/blob/8d5cdb5d536cc8eb444da4b57dca4e36716f4535/plugins/auth-backend-module-google-provider/config.d.ts#L22).
This field can be generated by the `backstage-cli repo fix` command. It will set to `false` by default for all frontend packages, since Backstage frontend packages should generally never have any side effects. If your package does have side effects, you can set explicitly set this field to `true`.