Proposal - require dependency directly from databases instead of use `Store.use`
See original GitHub issueProposal
require dependency directly from databases instead of use Store.use
For example:
aws = require('aws-sdk
); instead of aws = Store.use(‘aws-sdk’);
I propose this idea because I have some issues.
Background
I using AWS Lambda with serverless and serverless-webpack
I want to use eventstore with dynamodb from lambda but I got some errors. btw, I’ve installed aws-sdk
and works on my local.
1. Implementation for db \"dynamodb\" does not exist!
.
my code:
import eventstore from 'eventstore';
eventstore({ type: 'dynamodb' });
then I tried pass the DynamoDB class to eventstore, but I got another error Cannot find module 'aws-sdk' from parent
my code:
import eventstore from 'eventstore';
import DynamoDB from 'eventstore/lib/databases/dynamodb';
eventstore({ type: DynamoDB });
Some of my thoughts
About the issue 1 and 2. I think it’s because it cannot find modules via require
after webpack bundled.
https://github.com/adrai/node-eventstore/blob/master/index.js#L42
https://github.com/adrai/node-eventstore/blob/master/lib/databases/dynamodb.js#L2
https://github.com/adrai/node-eventstore/blob/master/lib/base.js#L172
So, that’s why I propose this idea.
Issue Analytics
- State:
- Created 6 years ago
- Comments:20 (8 by maintainers)
Top GitHub Comments
I had a similar problem with
eventstore
and it got solved by using webpack-node-externals.btw, finally I solved the issue by using babel because babel only do transpile.