You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
they are listed under dependencies in package.json
AND
they are part of Webpack compilation "chunks" (i.e. are imported in user's code)
What's the use of the second condition ? A dependency can be in package.json and not directly used in code : in the case of a peer-dependency of other dependencies... However if not packed these dependencies will crash...
Cheers !
PS : The solution I use for this is to import the peer-dependency in my handler.js without actually doing anything with it.
The text was updated successfully, but these errors were encountered:
Hi @guillaumervls ,
that's indeed a valid edge case 👍 , as for a peer dependency your code does not reference it but the dependency that introduces it does. This should be fixed by analyzing the dependency tree for peer dependencies of 2nd level dependencies that must be included.
To your question: A major use case for the plugin is to let Webpack optimize the code and only bundle external modules that are actually used. This leads to much smaller packages and faster Lambda cold start times. As soon as the peer dependency bug is fixed it should be consistent again.
As a function deployment is not a library but final code, it is also valid to use node-externals whitelist parameter to bundle a complete dependency into the code and let Webpack dismiss not needed 2nd level dependencies (optimally used together with the ES6 compatible UglifyJSPlugin of Webpack 3.x).
For dependencies that are neither peers nor referenced directly, there's a feature request #217 for the next release that will allow to explicitly add a dependency.
Hi,
As I understand, dependencies are packed if :
dependencies
inpackage.json
AND
What's the use of the second condition ? A dependency can be in
package.json
and not directly used in code : in the case of a peer-dependency of other dependencies... However if not packed these dependencies will crash...Cheers !
PS : The solution I use for this is to import the peer-dependency in my
handler.js
without actually doing anything with it.The text was updated successfully, but these errors were encountered: