The real example with serverless-plugin-typescript:
For instance of ServerlessAppSyncPlugin in constructor the object gets original serverless.config.servicePath, but after hooks calling this object changes and servicePath gets path with new prefix (.build).
We can't know how the original object can changes, so I find simple solution: store the field with path in object properties:
In class constructor we'll add: this.servicePath = serverless.config.servicePath and this.serverless.config.servicePath callings we'll change to this.servicePath.
Good day! When you initialize the instance of appsync emulator you can pass wrong path of yml file, because other plugins (for example serverless-plugin-typescript) can mutate
this.serverless
object.The real example with
serverless-plugin-typescript
: For instance ofServerlessAppSyncPlugin
in constructor the object gets originalserverless.config.servicePath
, but after hooks calling this object changes and servicePath gets path with new prefix (.build
). We can't know how the original object can changes, so I find simple solution: store the field with path in object properties:In class constructor we'll add:
this.servicePath = serverless.config.servicePath
andthis.serverless.config.servicePath
callings we'll change tothis.servicePath
.If it's good idea I can create the PR. Thank you!