Treeshaking not working in npm pushed library ng-packagr used

Discussão em 'Angular' iniciado por Mahesh Reddy, Maio 20, 2025.

  1. Mahesh Reddy

    Mahesh Reddy Guest

    This is a library which had bunch of utils, when I have used ngPackagr to create library and published in npm when i import one of the export in the npm other imports are also getting bundled i have observed this in webpack-analyzer,

    Example: import { getWmProjectProperties } from 'core-wm-treeshaking';

    console.log( getWmProjectProperties ); this file had only few line of js function but all the other module also getting bundled ex lodash-es even thought it's not used in getWmProjectPropertes i have checked fesm it look fine still didn't understood why this is happening, with same config its working fine when i created a npm for calculator add, sub, mul

    Published NPM (fesm)

    Continue reading...

Compartilhe esta Página