← All tasks
javascriptajv-validator/ajv #2479Not a task: already works

Add `sideEffects: false` flag to `package.json` to allow tree-shaking

envgap__ajv-validator__ajv-2479

01 / FAILURE SIGNATURE

As reported upstream

No identifying execution failure has been captured.
Not a benchmark task.
  • The project already builds and runs before the fix, so there is nothing to repair.

02 / ENVIRONMENT RECIPE

Base commit
9050ba1359fb87cd7c143f3c79513ea7624ea443
Manifest
package.json
Reproduce
Awaiting issue-specific recipe
Run under trace
Awaiting a meaningful runtime command

03 / ORIGINAL ISSUE TEXT

ajv-validator/ajv #2479 · read the original issue
I have a library that amongst others exports a utility function `createAjvValidator ` that uses `ajv`. Now, not all users of my library use this utility function, but I noticed that the Ajv library is always included when creating a js bundle containing my library, also when the ajv utility function is not used at all. It turns out that tree-shaking is not working.



Can the flag `"sideEffects": false` be added to the `package.json` file of `ajv`? That will enable tree shaking by Vite/Rollup/Webpack out of the box.



See:



- https://webpack.js.org/guides/tree-shaking/#mark-the-file-as-side-effect-free

- https://github.com/rollup/rollup/issues/2593
Continue on GitHub ↗

04 / LABELS

Labels from the report text only; not yet run

No supported category has been assigned.

Label rules and the text that matched
[]