Node.js-specific Architect plugin based on node-prune
that cleans node_modules
cruft from your Functions during deployment
Installation
-
Run: npm i @architect/arc-plugin-node-prune
-
Then add the following to your Architect project file (usually .arc
):
@plugins
architect/arc-plugin-node-prune
Note, no @
in the plugin name!
- Deploy your project (
npx deploy
) and watch the filesizes drop!
Disabling the plugin
If for whatever reason you need to disable the plugin, simply comment it out in (or remove it from) your Architect project file:
@plugins
# architect/arc-plugin-node-prune
Limitations
- Architect supports shared code by selectively copying
src/shared
and src/views
into all Functions' node_modules
dirs by default.
- Because this plugin runs just prior to deployment, it must avoid Architect shared code dirs so as not to inadvertently destroy user files.
- As such, any modules shared via
src/shared
and src/views
will not be pruned.
- This plugin relies on shelling out to a bash script, so ymmv on Windows.