Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 1.8k
ref(build): Use rollup to build AWS lambda layer#5146
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
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
da10e941a6a911f720781786851e9b9979a7bcd6638199b59845d0176793dee47d44f1876a3e2a487cbfffead19cae6b01fe2c4b6cce54c0File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { makeBaseBundleConfig, makeBundleConfigVariants, makeBaseNPMConfig } from '../../rollup/index.js'; | ||
| export default [ | ||
| // The SDK | ||
| ...makeBundleConfigVariants( | ||
| makeBaseBundleConfig({ | ||
| // this automatically sets it to be CJS | ||
| bundleType: 'node', | ||
| entrypoints: ['src/index.awslambda.ts'], | ||
| jsVersion: 'es6', | ||
| licenseTitle: '@sentry/serverless', | ||
| outputFileBase: () => 'index', | ||
| packageSpecificConfig: { | ||
| output: { | ||
| dir: 'build/aws/dist-serverless/nodejs/node_modules/@sentry/serverless/build/npm/cjs', | ||
| sourcemap: false, | ||
| }, | ||
| }, | ||
| }), | ||
| // We only need one copy of the SDK, and we pick the minified one because there's a cap on how big a lambda function | ||
| // plus its dependencies can be, and we might as well take up as little of that space as is necessary. We'll rename | ||
| // it to be `index.js` in the build script, since it's standing in for the index file of the npm package. | ||
| { variants: ['.min.js'] }, | ||
| ), | ||
| // This builds a wrapper file, which our lambda layer integration automatically sets up to run as soon as node | ||
| // launches (via the `NODE_OPTIONS="-r @sentry/serverless/dist/awslambda-auto"` variable). Note the inclusion in this | ||
| // path of the legacy `dist` folder; for backwards compatibility, in the build script we'll copy the file there. | ||
| makeBaseNPMConfig({ | ||
| entrypoints: ['src/awslambda-auto.ts'], | ||
| packageSpecificConfig: { | ||
| // Normally `makeNPMConfigVariants` sets both of these values for us, but we don't actually want the ESM variant, | ||
| // and the directory structure is different than normal, so we have to do it ourselves. | ||
| output: { | ||
| format: 'cjs', | ||
| dir: 'build/aws/dist-serverless/nodejs/node_modules/@sentry/serverless/build/npm/cjs', | ||
| sourcemap: false, | ||
| }, | ||
| // We only want `awslambda-auto.js`, not the modules that it imports, because they're all included in the bundle | ||
| // we generate above | ||
| external: ['./index'], | ||
| }, | ||
| }), | ||
| ]; |
Uh oh!
There was an error while loading. Please reload this page.
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.
This will be refactored in an upcoming PR, right?
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.
Depends on your definition of "upcoming." 😛
But yes, eventually, once I've applied the "wait only as long as you need to" to all of the "extras" steps, then the "extras" build can happen in parallel with the others, and this can move back under that umbrella.