Skip to content

Module not found: Can't resolve './libsodium.mjs' with Turbopack #18

@manu-xmint

Description

@manu-xmint

Summary

When using libsodium-wrappers (v0.7.15) with Next.js 15.2.8 and Turbopack enabled (next dev --turbopack), the build fails with a module resolution error.

Error

Module not found: Can't resolve './libsodium.mjs'

> 1 | import e from"./libsodium.mjs";let a;const r={},t=e.ready.then(function(){...

Environment

  • Next.js version: 15.2.8
  • Node.js version: (run node -v)
  • Operating System: macOS
  • Package manager: npm
  • libsodium-wrappers version: 0.7.15

Steps to Reproduce

  1. Create a Next.js project with Turbopack
  2. Install libsodium-wrappers: npm install libsodium-wrappers
  3. Import and use libsodium-wrappers in any component or API route
  4. Run next dev --turbopack
  5. Visit a page that uses the library

Expected Behavior

The module should resolve correctly and the application should run.

Actual Behavior

Build fails with Module not found: Can't resolve './libsodium.mjs'

Workaround

Running without Turbopack (next dev instead of next dev --turbopack) works correctly.

Additional Context

The libsodium-wrappers package uses dynamic imports and WASM files that Turbopack may not be handling correctly. The standard webpack bundler in Next.js resolves this without issues.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions