npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Run script from package upon its installation

I’m experimenting with a method of bundling that requires no alternative module formats to be shipped (published to NPM) alongside my source code. I’m wondering if there’s a way to add some kind of an install hook to my package? I understand this might be a security vulnerability… but it would be super useful to allow packages to––upon their installation––execute some code scoped to their directory within node_modules. Is this doable by any means?

Thank you for reading this through!!!

Kind regards,