Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
cannot include dependencies not required by bundle (knex pg). #217
I'm using knex and bookshelf with pg-library, the problem is that the pg library does not get bundled in to node_modules directory because it is not required in the files that get bundled (but is required by knex on runtime). This causes AWS Lambda to throw following errors.
2017-09-08T07:28:40.829Z 52dbac4f-9467-11e7-af3a-fdbf9a737897 Knex: run
Probably the cause is that this is not direct depency but resolved one during runtime which is then not resolved by webpack during bundling. I would appreciate a lot if this could work, although i could also probably just:
var dump = require("pg");
in order to get it bundled for now
Hi @jonni-larjomaa . Thanks for bringing this up
Yes, currently it is indeed so, that Webpack optimizes the package and reports the needed dependencies to the plugin, that in turn uses them to build a working package. As long as webpack does not know that a specific module is needed, although it is not referenced, it will not be packaged.
Good to know that it works with your workaround.
This is a missing feature that could be implemented quite easily. My proposal would be that we just use the
In your case you would then specify:
This will then do a forced package of the