Serverless Node.js Starter

From @jayair on Mon Apr 10 2017 01:11:24 GMT+0000 (UTC)

Link to chapter - http://serverless-stack.com/chapters/serverless-es7-service.html

Copied from original issue: https://github.com/AnomalyInnovations/serverless-stack-com/issues/72

The comment’s link for the previous chapter, Connect to API Gateway with IAM Auth, redirects to a page with a message:
“Oops! That page doesn’t exist or is private.”

1 Like

Good catch! Thanks for pointing it out. Fixed.

I’m trying to add relative module paths to my functions, so that I could write

import dynamodb from ‘libs/dynamodb’

Instead of

import dynamodb from ‘../../libs/dynamodb’

Is there any way to add a configuration for relative module paths? For instance, in pure webpack, we would write the following:

const path = require('path');

module.exports = {
  resolve: {
    alias: {
      libs: path.resolve(__dirname, '../../libs'),
    }
  }
};

I’ve tried webpack.config.js, which gets ignored. I tried configuring severless-webpack in serverless.yml, but serverless-bundle won’t allow it. Anyone knows how this could work?

Thanks…

Yup, exactly. You’ll need to use serverless-webpack directly for that. There were some discussions of adding this to serverless-bundle. But it’s still ongoing.

1 Like