Skip to content

Commit

Permalink
fix: enforce target args in bundler (#3588)
Browse files Browse the repository at this point in the history
* fix: enforce target args in bundler

* chore: add changeset
  • Loading branch information
bayssmekanique committed Dec 18, 2023
1 parent bb195c2 commit b827904
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 13 deletions.
5 changes: 5 additions & 0 deletions .changeset/plenty-laws-pay.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"sst": patch
---

SsrSite: fixes function bundler to match deployment target on bundled dependencies.
24 changes: 11 additions & 13 deletions packages/sst/src/runtime/handlers/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,29 +255,27 @@ export const useNodeHandler = (): RuntimeHandler => {
),
})
);
const cmd = ["npm install"];
const cmd = [
"npm install",
"--platform=linux",
"--omit=dev",
"--no-optional",
input.props.architecture === "arm_64"
? "--arch=arm64"
: "--arch=x64",
];

if (installPackages.includes("sharp")) {
/**
* TODO: This is a workaround for issues that sharp v0.33.0 has
* with cross platform builds. This can be removed once sharp
* releases a new version with the fix.
*/
cmd.push(
"--platform=linux",
"--omit=dev",
"--no-optional",
input.props.architecture === "arm_64"
? "--arch=arm64"
: "--arch=x64",
"--force sharp@0.32.6"
);
cmd.push("--force sharp@0.32.6");
/**
* Once the above issue is resolved, the code below can be used.
*/
// cmd.push(
// "--platform=linux",
// "--omit=dev",
// "--no-optional",
// ...input.props.architecture === "arm_64"
// ? ["--arch=arm64", "--force @img/sharp-linux-arm64"]
// : ["--arch=x64", "--force @img/sharp-linux-x64"],
Expand Down

0 comments on commit b827904

Please sign in to comment.