For anyone who has been using sst with typescript ...
# help
n
For anyone who has been using sst with typescript and yarn workspaces, have you ever seen the issue where your lambda code doesn't seem to be transpiling correctly? i.e. when I try to hit my endpoint it gives me the error in local terminal
SyntaxError: Unexpected token 'export'
which leads me to believe my code is being interpreted as typescript instead of javascript when it is uploaded to AWS. I am largely following the setup described in this repo but attempting to have separate workspaces for each service/core lib. I might just be overcomplicating this and should be resorting back to just having the whole backend folder as a workspace, but if I can get it working that would be cool. My current tsconfig for the services is in screenshot #1. And my base tsconfig file is in screenshot #2. Any thoughts/resources on this would be helpful. Been trawling through the ts handbook, but no luck so far 😅
p
I am facing with same issue. When I referred to the
learna-yarn-starter
code for serverless and SST I see difference in example. For
serverless
, in the following example. The
import/export
works perfectly. Sample
workspace
package is getting transpiled properly
Copy code
export default function sample() {
  return "sample package";
}
While for
SST
, the example uses
module.exports
if I change it to
export
default
*function* sample()
, SST will throw error
SyntaxError: Unexpected token 'export'
Copy code
module.exports = function sample() {
  return "sample package";
}
Question is: 1. What is so special about
serverless
framework which makes it to
transpile
the imported
workspace
package. 2. Can we do the same with SST, so that it transpiles the imported
workspace
package?