3 ms·
This was my concern as well. Looking at the script source, it's just matching globs, so there isn't much smarts to this. I'm sure it works most of the time,
by sbarre 3y ago
This was my concern as well.
Looking at the script source, it's just matching globs, so there isn't much smarts to this. I'm sure it works most of the time, but yeah..
Do JS packages need some kind of .prodignore file similar to other .ignore files?
So with a flag passed, after doing an npm install, there's a extra cleanup step that removes explicitly marked files that aren't needed for running in prod?
(Not a fully formed idea, I'm sure I'm not thinking of drawbacks with this)
Edit: this sort of exists as the .npmignore file?
https://docs.npmjs.com/cli/v10/using-npm/developers#keeping-files-out-of-your-package https://docs.npmjs.com/cli/v10/using-npm/developers#keeping-...
- rezonant 3y ago.npmignore is the opposite of `files`, it omits files when creating the package itself, that's different than trimming the files when the package is installed. That said, files/npmignore is the correct way to deal with this and you should never remove files from the packages you install without extremely good reasons, and when you do it, it should be very narrowly scoped and handled automatically as part of npm install. It should be totally valid to delete node_modules and reinstall everything without causing problems. This is also the biggest reason to never commit node_modules, aside from the pure insanity of commiting hundreds of thousands of vendor managed files and inviting merge conflicts when two branches change those files...