-
Notifications
You must be signed in to change notification settings - Fork 87
fix: force serverless target #408
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
0c67715
to
af78226
Compare
|
||
// Creating a config file, because otherwise Next won't reload the config and pick up the new target | ||
|
||
if (!(await findUp('next.config.js'))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fyi this is part of the monorepo problem. just an fyi we can address later
helpers/verifyBuildTarget.js
Outdated
// Creating a config file, because otherwise Next won't reload the config and pick up the new target | ||
|
||
if (!(await findUp('next.config.js'))) { | ||
await writeFile(path.resolve('next.config.js'), `module.exports = {}`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
at this should we maybe just add the target prop in here as a backup? not necessary ofc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I'm unsure what's best.
This is another attempt at #343, forcing the target to "serverless". The previous PR had to be reverted, because it didn't work when there was no next.config.js file. The target stayed as "server", meaning no serverless files were generated. This is because for some reason Next.js didn't change the target unless the config file at least exists. We work around this by creating the file if it doesn't exist, but without any config in it.