dougmoscrop / serverless-plugin-include-dependencies

MIT License
184 stars 40 forks source link

Add a cache system #31

Closed n-peugnet closed 5 years ago

n-peugnet commented 5 years ago

If I understood correctly, this plugin includes dependencies by browsing recursively every file looking for require calls.

This process takes a lot of time if the dependencies tree is big and could be made a lot faster with a cache system.

For example the npm packages dependencies never changes except when the version changes so after it has been browsed once, no need to recheck it in further deployment.

dougmoscrop commented 5 years ago

It only parses the AST for local files, once it finds a dependency in node_modules, it switches to just pulling in dependencies noted in package.json (too many corner cases).

Since recent npm dedupes natively, I'm not sure the advantage of a cache. I've never seen this package step take very long, but the built-in serverless one does. Make sure you set:

package:
  excludeDevDependencies: false
n-peugnet commented 5 years ago

Thank you it was as you said the built-in one that took a lot of time.

However I didn't find this information anywhere in your docs.

dougmoscrop commented 5 years ago

Thanks, good point! I added it to the README.