-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Introduce bundling with esbuild, --hotswap
and --watch
#1321
Conversation
🦋 Changeset detectedLatest commit: d0c53bc The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
@@ -163,7 +163,7 @@ exports[`returns expected CloudFormation stack for dev 1`] = ` | |||
}, | |||
}, | |||
"FunctionName": "serviceName", | |||
"Handler": "app.handler", | |||
"Handler": "index.handler", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The handler value will be automatically prefixed with the bundled output file name, index., unless the handler value contains a . character, in which case the handler value is used as-is to allow for values needed by some Lambda extensions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should rename the source file to index.ts
to align 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it's very necessary, just a bundling thing tbh
runtime: aws_lambda.Runtime.NODEJS_20_X, | ||
handler: 'app.handler', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, an entry file and handler can be specified:
new nodejs.NodejsFunction(this, 'MyFunction', { entry: '/path/to/my/file.ts', // accepts .js, .jsx, .cjs, .mjs, .ts, .tsx, .cts and .mts files handler: 'myExportedFunc', // defaults to 'handler' });
--hotswap
and --watch
@@ -4,6 +4,8 @@ | |||
"scripts": { | |||
"build": "skuba build", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this render skuba build
redundant for this template?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ruh roh looks like removing this causes issues with test-template
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Heh, I think we can catch and ignore "Command not found" errors there 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👏
@@ -4,6 +4,8 @@ | |||
"scripts": { | |||
"build": "skuba build", | |||
"deploy": "cdk deploy appStack --require-approval never --context stage=${ENVIRONMENT}", | |||
"deploy:hotswap": "yarn deploy --hotswap", | |||
"deploy:watch": "yarn deploy:hotswap --watch", | |||
"format": "skuba format", | |||
"lint": "skuba lint", | |||
"package": "yarn install --ignore-optional --ignore-scripts --modules-folder ./lib/node_modules --non-interactive --offline --production", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this packaging malarkey?
Related: #1311