3

In my serverless.yml, I use both serverless-tscpaths plugin for resolving paths defined in tsconfig and serverless-plugin-optimize for minifying and reducing the bundle size. However when the serverless-tscpaths plugin is executed all the paths defined in tsconfig are converted to relative paths which doesn't work with minified file.

This problem may be outside of these plugins and just how babel minifying works. Not sure what the solution is here.

Thanks

user3536652
  • 153
  • 2
  • 12

1 Answers1

0

I was able to resolve this error by changing the placement of the serverless-tscpaths plugin in serverless.yml file. Now I am with another error as below.

{
    "errorType": "TypeError",
    "errorMessage": "module.require is not a function",
    "stack": [
        "TypeError: module.require is not a function",
        "    at Object.default_1 [as default] (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:59247:23)",
        "    at Object.generateSchemaHash (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:59389:31)",
        "    at ApolloServer.generateSchemaDerivedData (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:58226:41)",
        "    at new ApolloServerBase (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:58145:38)",
        "    at new ApolloServer (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:59709:9)",
        "    at GraphQLModule.registerExpress (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:26510:30)",
        "    at GraphQLModule.registerGqlServer (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:26495:18)",
        "    at GraphQLModule.<anonymous> (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:26485:18)",
        "    at Generator.next (<anonymous>)",
        "    at fulfilled (/var/task/_optimize/cosmos-graphql-qavj/src/lambda.js:827857:62)",
        "    at processTicksAndRejections (internal/process/task_queues.js:97:5)"
    ]
}

These are the list of plugins I am currently using

- serverless-plugin-typescript
- serverless-tscpaths
- serverless-plugin-optimize
- serverless-offline
- serverless-domain-manager

Am I missing the usage of serverless-webpack?

user3536652
  • 153
  • 2
  • 12