Open jacksors opened 1 week ago
I haven't tried it recently but usually it only bundles that directory if you have dependencies in the nodejs.install
. Do you have something like that? Can I see your sst config for the Next.js site?
I'm not sure what you mean by in the nodejs.install
, could you clarify? Like global packages? Here's my config:
import { vpc } from "./vpc";
import {
betterAuthSecret,
googleClientId,
googleClientSecret,
queueApiKey,
WEB_URL,
} from "./secrets";
import { appDb } from "./app-db";
import { bullmqPrimary } from "./bullmq";
import { devEmail, email, emailTemplate } from "./messaging";
export const web = new sst.aws.Nextjs("Web", {
vpc,
path: "applications/web/",
dev: {
url: "http://localhost:3000",
},
link: [
appDb,
googleClientId,
googleClientSecret,
queueApiKey,
betterAuthSecret,
bullmqPrimary,
emailTemplate,
email ? email : [],
devEmail ? devEmail : [],
],
environment: { WEB_URL },
});
The workaround I'm currently using is just removing applications/web/
from my root package.json so the nextjs app's dependencies are handled separately from the rest of the monorepo's, but this breaks the automated deployment on the SST cosole since that only installs packages in the root directory.
Thanks for taking a look at this!
That looks okay to me. We'll need to test this out.
When deploying an opennext app that's inside of an npm monorepo using workspaces, a
node_modules
folder is not bundled in the open nextserver_functions
folder as it is when building a nextjs app with open next outside of a monorepo (when there is anode_modules
folder inside the nextjs root).For instance, if we have a nextjs app located at applications/nextjs, and we run
sst deploy
from the monorepo root where the rootpackage.json
andsst.config.ts
is located, the built app will not have any dependencies included and will not be able to run.