would be cool to see a lerna + typescript + serverless-webpack example #315
Replies: 7 comments
-
I have an example working. However, I am seeing an error on the @example/lib dependancy... offline: Failure: Module parse failed: The keyword 'interface' is reserved (11:0) |
Beta Was this translation helpful? Give feedback.
-
I haven't used serverless-webpack, but would the example be different from the included webpack example?
Usually this means your loaders are not set up to compile code outside the current module. Notice how the loader in the example doesn't have an |
Beta Was this translation helpful? Give feedback.
-
I'm on the same path, trying to use a monorepo with typescript and serverless webpack. This basically works with the webpack example. But in most serverless projects I did, sooner or later I encountered some webpack-incompatible modules. But if you want to exclude some webpack-incompatible packages, the example does not work any more. If you exclude them in webpack.config.js with
you'll get a runtime error
After this I tried to set the node_modules path to the root in the serverless webpack config:
This leads to a webpack compile time error: Not sure why, but I believe this is due to the way serverless-webpack handles dependencies. I believe they try to bundle with webpack and do an npm install in the webpack ouput folder. I extended the repo to showcase this (NPM branch): https://github.com/florianbepunkt/ts-monorepo/tree/npm In case anyone finds a solution for this, a heads up would be nice. |
Beta Was this translation helpful? Give feedback.
-
I managed to build a perfect solution using workspaces and serverless-optimize. The only complication was that mongodb needs to be extracted into a lambda layer and installed locally as a devDep. |
Beta Was this translation helpful? Give feedback.
-
@derek-lewis Do you have an example repo by any chance? |
Beta Was this translation helpful? Give feedback.
-
I will look to get an example repo up for you 👍🏼 |
Beta Was this translation helpful? Give feedback.
-
@derek-lewis i have created a pull request for serverless application #303 |
Beta Was this translation helpful? Give feedback.
-
Would be great to see an example of:
/example
--/lib/test.ts
--/serverless-api (AWS API Gateway)
--- depends on @example/core
Beta Was this translation helpful? Give feedback.
All reactions