Skip to content
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

fix(nextjs): use require("next") since exports.default is no longer provided #16497

Merged
merged 1 commit into from
Apr 24, 2023

Conversation

jaysoo
Copy link
Member

@jaysoo jaysoo commented Apr 24, 2023

WIth Next.js 13.3.1, exports.default is no longer provided when imported as a CommonJS module. This is breaking our serve executor.

Current Behavior

Expected Behavior

Related Issue(s)

Fixes #16479

@vercel
Copy link

vercel bot commented Apr 24, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
nx-dev ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 24, 2023 0:58am

@ndcunningham ndcunningham merged commit 786323d into nrwl:master Apr 24, 2023
3 checks passed
@jaysoo jaysoo deleted the fix/nextjs-correct-import branch April 24, 2023 16:02
@Brian-McBride
Copy link

Brian-McBride commented Apr 24, 2023

Why use require?
It looks like there is a named export from the nextjs NPM package.

module.exports = createServer;

You should be able to:

import { createServer } from 'next';

// ...

  const app = createServer(settings);
  const handle = app.getRequestHandler();

FrozenPandaz pushed a commit that referenced this pull request Apr 24, 2023
FrozenPandaz pushed a commit that referenced this pull request Apr 24, 2023
FrozenPandaz pushed a commit that referenced this pull request Apr 25, 2023
@jrood
Copy link

jrood commented Apr 25, 2023

Nice timing. I just ran into this issue yesterday! Thanks for the fix!

@github-actions
Copy link

github-actions bot commented May 1, 2023

This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 1, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Serve task fails on latest Next.js version (13.3.1)
4 participants