Skip to content

Commit

Permalink
Enable bundling for server build
Browse files Browse the repository at this point in the history
Bundle all of the dependencies for the server build instead of
uploading node_modules. This results in much smaller Lambda sizes
and should translate to much faster cold starts.
  • Loading branch information
lpsinger committed Mar 11, 2023
1 parent 5aa217a commit 1dfda3a
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 541 deletions.
8 changes: 4 additions & 4 deletions build/server/tracing.js
Expand Up @@ -2,14 +2,14 @@ global.configureInstrumentations = () => {
const { DnsInstrumentation } = require('@opentelemetry/instrumentation-dns')
const { HttpInstrumentation } = require('@opentelemetry/instrumentation-http')
const { NetInstrumentation } = require('@opentelemetry/instrumentation-net')
const {
RemixInstrumentation,
} = require('opentelemetry-instrumentation-remix')
// const {
// RemixInstrumentation,
// } = require('opentelemetry-instrumentation-remix')

return [
new DnsInstrumentation(),
new HttpInstrumentation(),
new NetInstrumentation(),
new RemixInstrumentation(),
// new RemixInstrumentation(),
]
}
13 changes: 3 additions & 10 deletions esbuild.mjs
Expand Up @@ -11,16 +11,9 @@ await build({
logLevel: 'info',
outdir: 'build',
outbase: 'app',
plugins: [
{
name: 'exclude node_modules from bundling',
setup(build) {
build.onResolve({ filter: /^(?:[^./~]|~[^/])/ }, () => ({
external: true,
}))
},
},
],
external: ['@aws-sdk/*'],
platform: 'node',
minify: true,
target: ['node18'],
watch,
})

0 comments on commit 1dfda3a

Please sign in to comment.