TypeScript Serverless chassis not combining $ref'd Resources

Hi There,

I have a Serverless Deployment Chassis that I have been using for about 3 years, you can find it here.

I am in the process of converting this to a TypeScript variant which for the most part is successful. I can call functions on the generated URLs.

There is an issue however as my Resources section looks like this

resources:
  Resources:
    #this entry allows access to the otherwise tricky deployment resource
    __deployment__:
      Properties:
        Description: Deployment alias for resources that depend on deployment id
    IamPolicyLambdaDynamo:
      $ref: ./configurators/iamPolicyLambdaDynamo.yaml
    #PathMapping:
    #  $ref: ./configurators/pathMapping.yaml
    #ApiGatewayStage:
    #  $ref: ./configurators/apiGatewayStage.yaml

Building the service with anything in Resources that points to an external file is not being found. I expect this is something to do with Webpack.

The error goes away if all the resources are commented. The error being The CloudFormation template is invalid: Invalid template resource property '$ref'

Anyone seen anything like this and knows what we need to do?

Well how bout that. One of the changes I made while migrating the chassis to TypeScript means it no longer replaces $ref: with the file at build time.

This alternate syntax works:

resources:
  Resources:
    #this entry allows access to the otherwise tricky deployment resource
    __deployment__:
      Properties:
        Description: Deployment alias for resources that depend on deployment id
    ApiGatewayStage: ${file(configurators/apiGatewayStage.yaml)}
    IamPolicyLambdaDynamo: ${file(configurators/iamPolicyLambdaDynamo.yaml)}
    PathMapping: ${file(configurators/pathMapping.yaml)}