Skip to content

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

Merged
merged 6 commits into from
Jun 11, 2021
Merged

fix: force serverless target #408

merged 6 commits into from
Jun 11, 2021

Conversation

ascorbic
Copy link
Contributor

@ascorbic ascorbic commented Jun 11, 2021

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.

@ascorbic ascorbic requested a review from lindsaylevine June 11, 2021 10:11
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Jun 11, 2021
@ascorbic ascorbic force-pushed the mk/force-serverless branch from 0c67715 to af78226 Compare June 11, 2021 10:29

// Creating a config file, because otherwise Next won't reload the config and pick up the new target

if (!(await findUp('next.config.js'))) {

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

// 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 = {}`)

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

Copy link
Contributor Author

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.

@ascorbic ascorbic requested a review from lindsaylevine June 11, 2021 11:04
@ascorbic ascorbic merged commit 8dff29d into main Jun 11, 2021
@ascorbic ascorbic deleted the mk/force-serverless branch June 11, 2021 12:21
serhalp pushed a commit that referenced this pull request Jun 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants