Describe the bug
DSpace uses several dependencies that are packaged as AMD or CommonJS modules, which leads to several warnings during the build process. For example:
Warning: dspace-angular/src/app/core/services/client-cookie.service.ts depends on 'js-cookie'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.dev/tools/cli/build#configuring-commonjs-dependencies
This can lead to sub-optimal tree shaking in Webpack. Using ES Module (ESM) versions of these dependencies where possible allows Webpack to eliminate unused code, reducing bundle size and improving performance.
The list of dependencies causing these warnings is currently:
- js-cookie
- orejime/dist/orejime
- leaflet
- leaflet-providers
- leaflet.markercluster
- date-fns-tz
Some of these may have drop-in replacements, while others may require code changes.
Related work
Part of the work was completed for DSpace 9 in #4098. There is also more discussion in #4095.
Describe the bug
DSpace uses several dependencies that are packaged as AMD or CommonJS modules, which leads to several warnings during the build process. For example:
This can lead to sub-optimal tree shaking in Webpack. Using ES Module (ESM) versions of these dependencies where possible allows Webpack to eliminate unused code, reducing bundle size and improving performance.
The list of dependencies causing these warnings is currently:
Some of these may have drop-in replacements, while others may require code changes.
Related work
Part of the work was completed for DSpace 9 in #4098. There is also more discussion in #4095.