borduhh / serverless-sam-typescript-boilerplate Goto Github PK
View Code? Open in Web Editor NEWAn AWS SAM CLI boilerplate with function and dependency layers using Typescript and Webpack.
License: Apache License 2.0
An AWS SAM CLI boilerplate with function and dependency layers using Typescript and Webpack.
License: Apache License 2.0
Hi Nick,
amazing tutorial so far.
Yet, almost by the end, when I need to build a Api Function (npm run build:prod) with altered webpack.config.ts I'm getting an error
[webpack-cli] webpack.config.ts:42:14 - error TS2304: Cannot find name 'EventSource'.
42 Events?: EventSource;
~~~~~~~~~~~
NOTE: please note that I've picked all the latest devDependencies and here is the list:
"devDependencies": {
"@types/aws-lambda": "^8.10.64",
"@types/jest": "^26.0.15",
"@types/node": "^14.14.2",
"@types/webpack": "^4.41.23",
"@typescript-eslint/eslint-plugin": "^4.5.0",
"@typescript-eslint/parser": "^4.5.0",
"eslint": "^7.11.0",
"eslint-config-prettier": "^6.14.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-prettier": "^3.1.4",
"jest": "^26.6.0",
"prettier": "^2.1.2",
"ts-jest": "^26.4.1",
"ts-loader": "^8.0.6",
"ts-node": "^9.0.0",
"typescript": "^4.0.3",
"webpack": "^5.1.3",
"webpack-cli": "^4.1.0",
"yaml-cfn": "^0.2.3"
}
If I look into ISamFunction interface in that webpack.config.js, all are "primitives" except that Events?: EventSource
.
Can it be that it is referenced somewhere? Maybe you have some global npm module installed?
Hello man,
Thanks for the boilerplate.
Let's imagine a scenario where a function uses lodash, we would install lodash dependency in global layer so it can be reused without bloat the function up (many functions use it)
The problem is that functions can't reference the installed module and keep linting "module not found" when coding the function body.
The first workaround was to install lodash as dev dependency in the function folder so lint error stopped, however, when we build to deploy using webpack, the generated JS includes ALL de dev dependency in the function which makes it very heavy and the global layer unecessary.
How can we solve it?
Something about ignore devDependencies when compile?
I have spend many hours trying different solutions but with no luck. Your help would be appreciated.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.