Skip to content

node:crypto issues in Next.js #659

Closed
@inlet

Description

@inlet

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Fastify version

5.9.0

Plugin version

No response

Node.js version

20.6.0

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

Sonoma 14.0

Description

When using fast-json-stringify in a Next.js site (client component), it breaks because it refers to node:crypto.

It outputs:

Module build failed: UnhandledSchemeError: Reading from "node:crypto" is not handled by plugins (Unhandled scheme).
Webpack supports "data:" and "file:" URIs by default.
You may need an additional plugin to handle "node:" URIs.
Import trace for requested module:
node:crypto
./node_modules/fast-json-stringify/index.js

Steps to Reproduce

See this codesandbox demo

Expected Behavior

It should work in the browser as well. When running this it should not prompt this error but instead continue compiling and rendering the result in the browser

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