Skip to content

Playground fails to start with Next.js 16 (Turbopack) - Module not found: Can't resolve 'fs' #1216

@Satya900

Description

@Satya900

🐛 Description

When running npm start in the playground directory, the build fails with the following error:

Module not found: Can't resolve 'fs'

The error originates from dependencies such as avsc, which are pulled in via @asyncapi/parser.

This happens because Next.js 16 uses Turbopack by default in development mode, and Turbopack does not respect the existing Webpack configuration defined in next.config.mjs that mocks the fs module (fs: false).


🔁 Steps to Reproduce

  1. Navigate to the playground directory

  2. Run:

    npm start
  3. Observe the build failure with:

    Module not found: Can't resolve 'fs'
    

✅ Expected Behavior

The playground should start successfully in development mode, consistent with the behavior when using Webpack.


⚠️ Workaround

Running Next.js explicitly with Webpack resolves the issue temporarily:

npx next dev --webpack

💡 Possible Solutions

We should consider one of the following:

  1. Update next.config.mjs to include a Turbopack-compatible configuration that aliases or mocks the fs module.
  2. Update the npm start script to explicitly use --webpack until proper Turbopack support is added.

🖥️ Environment

  • OS: Windows
  • Node.js Version: 25.5.0
  • Next.js Version: 16.1.5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions