Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/open-next/src/build/createImageOptimizationBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,9 @@ export async function createImageOptimizationBundle(
outputPath,
config.imageOptimization?.install ?? {
packages: [`sharp@${sharpVersion}`],
arch: "arm64",
nodeVersion: "18",
libc: "glibc",
},
);
}
17 changes: 12 additions & 5 deletions packages/open-next/src/build/installDeps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,18 @@ export function installDependencies(
logger.info(`Installing dependencies for ${name}...`);
// We then need to run install in the tempDir
// We don't install in the output dir directly because it could contain a package.json, and npm would then try to reinstall not complete deps from tracing the files
const installCommand = `npm install --arch=${
installOptions.arch ?? "arm64"
} --platform=linux --target=${installOptions.nodeVersion ?? "18"} --libc=${
installOptions.libc ?? "glibc"
} ${installOptions.packages.join(" ")}`;
const archOption = installOptions.arch
? `--arch=${installOptions.arch}`
: "";
const targetOption = installOptions.nodeVersion
? `--target=${installOptions.nodeVersion}`
: "";
const libcOption = installOptions.libc
? `--libc=${installOptions.libc}`
: "";

const additionalArgs = installOptions.additionalArgs ?? "";
const installCommand = `npm install --platform=linux ${archOption} ${targetOption} ${libcOption} ${additionalArgs} ${installOptions.packages.join(" ")}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if the platform is Windows?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

People still use windows as a server ? 😂
That's only for the server. Honestly there is probably dozens of other issue trying to run OpenNext on windows.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I read someone was insterested in running ON on Azure 🤷
We'll cross that bridge when we get there.

execSync(installCommand, {
stdio: "pipe",
cwd: tempInstallDir,
Expand Down
13 changes: 9 additions & 4 deletions packages/open-next/src/types/open-next.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,17 +200,22 @@ export interface InstallOptions {
*/
packages: string[];
/**
* @default "arm64"
* @default undefined
*/
arch?: "x64" | "arm64";
/**
* @default "18"
* @default undefined
*/
nodeVersion?: "18" | "20" | "22";
nodeVersion?: string;
/**
* @default "glibc"
* @default undefined
*/
libc?: "glibc" | "musl";
/**
* @default undefined
* Additional arguments to pass to the install command (i.e. npm install)
*/
additionalArgs?: string;
}

export interface DefaultFunctionOptions<
Expand Down
Loading