We are using the following configuration for the package:
package: exclude: - 'node_modules/**'
This is similar to the example in the docs, but it seems, it does not work: the
node_modules directory is always included. The problem has already been reported a few times
I think, I have checked everything, but I cannot find the problem. Is it possible that something has changed and this is a bug in the current version?
For now, we do the following during deployment (Node project):
npm install mv node_modules ../node_modules.tmp # ignore-scripts: avoid running 'build' again, we only need dependencies npm install -s --prod --ignore-scripts sls deploy $* # pass through script arguments # restore node_modules directory rm -rf node_modules mv ../node_modules_service.tmp node_modules
A similar approach was also suggested by smkamranqadri on a previous question.
Are we doing something wrong, or how can we debug this?