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

Module not found: Can't resolve '_http_common' #70262

Open
kettanaito opened this issue Sep 19, 2024 · 0 comments
Open

Module not found: Can't resolve '_http_common' #70262

kettanaito opened this issue Sep 19, 2024 · 0 comments
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc. Runtime Related to Node.js or Edge Runtime with Next.js. Webpack Related to Webpack with Next.js.

Comments

@kettanaito
Copy link
Contributor

kettanaito commented Sep 19, 2024

Link to the code that reproduces this issue

mswjs/msw#2291

To Reproduce

Please follow the reproduction steps in the linked issue above.

Current vs. Expected behavior

Current

Next.js throws an error, unable to import a built-in _http_common module in Node.js.

Expectd

Next.js properly imports the built-in module.

Provide environment information

Irrelevant, this is a webpack configuration issue.

Which area(s) are affected? (Select all that apply)

Developer Experience, Runtime, Webpack

Which stage(s) are affected? (Select all that apply)

next dev (local), next build (local), next start (local), Vercel (Deployed)

Additional context

I believe this is caused by the Next's default webpack config not listing _http_common in config.externals.

Any thoughts on listing all built-in Node.js modules as external?

{
  // All built-in modules in Node.js must be treated as external.
  externals: require('module').builtinModules
}

I'm proposing this because contributors report that adding _http_common into config.externals helps them. This should be handled on Next's side.

@kettanaito kettanaito added the bug Issue was opened via the bug report template. label Sep 19, 2024
@github-actions github-actions bot added Developer Experience Issues related to Next.js logs, Error overlay, etc. Runtime Related to Node.js or Edge Runtime with Next.js. Webpack Related to Webpack with Next.js. labels Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Developer Experience Issues related to Next.js logs, Error overlay, etc. Runtime Related to Node.js or Edge Runtime with Next.js. Webpack Related to Webpack with Next.js.
Projects
None yet
Development

No branches or pull requests

1 participant