sst 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/constructs/RemixSite.d.ts +1 -0
- package/constructs/RemixSite.js +11 -6
- package/package.json +1 -1
package/constructs/RemixSite.js
CHANGED
|
@@ -60,7 +60,7 @@ export class RemixSite extends SsrSite {
|
|
|
60
60
|
clientBuildVersionedSubDir: "build",
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
createServerLambdaBundle(wrapperFile) {
|
|
63
|
+
createServerLambdaBundle(wrapperFile, external) {
|
|
64
64
|
// Create a Lambda@Edge handler for the Remix server bundle.
|
|
65
65
|
//
|
|
66
66
|
// Note: Remix does perform their own internal ESBuild process, but it
|
|
@@ -96,7 +96,7 @@ export class RemixSite extends SsrSite {
|
|
|
96
96
|
bundle: true,
|
|
97
97
|
target: "node16",
|
|
98
98
|
platform: "node",
|
|
99
|
-
external
|
|
99
|
+
external,
|
|
100
100
|
outfile: path.join(outputPath, "server.js"),
|
|
101
101
|
// We need to ensure that the polyfills are injected above other code that
|
|
102
102
|
// will depend on them. Importing them within the top of the lambda code
|
|
@@ -112,8 +112,9 @@ export class RemixSite extends SsrSite {
|
|
|
112
112
|
return outputPath;
|
|
113
113
|
}
|
|
114
114
|
createFunctionForRegional() {
|
|
115
|
-
const { runtime, timeout, memorySize, environment, cdk } = this.props;
|
|
116
|
-
const
|
|
115
|
+
const { runtime: runtimeRaw, timeout, memorySize, environment, cdk, } = this.props;
|
|
116
|
+
const runtime = this.normalizeRuntime(runtimeRaw);
|
|
117
|
+
const bundlePath = this.createServerLambdaBundle("regional-server.js", runtime === "nodejs18.x" ? [] : ["aws-sdk"]);
|
|
117
118
|
return new lambda.Function(this, `ServerFunction`, {
|
|
118
119
|
description: "Server handler for Remix",
|
|
119
120
|
handler: "server.handler",
|
|
@@ -138,8 +139,9 @@ export class RemixSite extends SsrSite {
|
|
|
138
139
|
});
|
|
139
140
|
}
|
|
140
141
|
createFunctionForEdge() {
|
|
141
|
-
const { runtime, timeout, memorySize, permissions, environment } = this.props;
|
|
142
|
-
const
|
|
142
|
+
const { runtime: runtimeRaw, timeout, memorySize, permissions, environment, } = this.props;
|
|
143
|
+
const runtime = this.normalizeRuntime(runtimeRaw);
|
|
144
|
+
const bundlePath = this.createServerLambdaBundle("edge-server.js", runtime === "nodejs18.x" ? [] : ["aws-sdk"]);
|
|
143
145
|
return new EdgeFunction(this, `Server`, {
|
|
144
146
|
scopeOverride: this,
|
|
145
147
|
format: "cjs",
|
|
@@ -152,4 +154,7 @@ export class RemixSite extends SsrSite {
|
|
|
152
154
|
environment,
|
|
153
155
|
});
|
|
154
156
|
}
|
|
157
|
+
normalizeRuntime(runtime) {
|
|
158
|
+
return runtime || "nodejs18.x";
|
|
159
|
+
}
|
|
155
160
|
}
|