-
-
Notifications
You must be signed in to change notification settings - Fork 143
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #323 from tinchoz49/tinchoz49/add-config-hook
feat: add support for config file
- Loading branch information
Showing
9 changed files
with
16,701 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
module.exports = () => { | ||
return { | ||
packager: 'npm', | ||
bundle: true, | ||
minify: true, | ||
sourcemap: false, | ||
keepNames: true, | ||
external: [ | ||
'lodash' | ||
], | ||
plugins: [ | ||
{ | ||
name: 'log-lodash', | ||
setup(build) { | ||
// test interception : log all lodash imports | ||
build.onResolve({ filter: /^lodash$/ }, args => { | ||
console.log(args); | ||
}); | ||
}, | ||
} | ||
] | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import * as _ from 'lodash'; | ||
|
||
// modern module syntax | ||
export async function handler(event, context, callback) { | ||
// dependencies work as expected | ||
console.log(_.VERSION); | ||
|
||
// async/await also works out of the box | ||
await new Promise((resolve) => setTimeout(resolve, 500)); | ||
|
||
const response = { | ||
statusCode: 200, | ||
body: JSON.stringify({ | ||
message: 'Go Serverless v1.0! Your function executed successfully!', | ||
input: event, | ||
}), | ||
}; | ||
|
||
callback(null, response); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// modern module syntax | ||
export async function handler(event, context, callback) { | ||
// async/await also works out of the box | ||
await new Promise((resolve) => setTimeout(resolve, 500)); | ||
|
||
const response = { | ||
statusCode: 200, | ||
body: JSON.stringify({ | ||
message: 'Go Serverless v1.0! Your function executed successfully!', | ||
input: event, | ||
}), | ||
}; | ||
|
||
callback(null, response); | ||
} |
Oops, something went wrong.