I\'m trying to publish a typescript library on NPM but I can\'t to have a \"good\" path after publishing.
I follow several guide on this point but I\'m not found a solut
The vast majority of module bundling tools follow Node's module resolution rules, which effectively say that if you specify a path after a library name, it will resolve that relative to the module's node_modules
folder. You can't override this, and it's almost certainly never going to change for backward compatibility reasons.
Without asking for your users to configure their module bundler, the only way this can be achieved is by publishing your package with the directory structure matching that which you wish to expose to your users. You could use scripts/NPM hooks (e.g. prepublish
and postpublish
) to automate this.