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
- Create a Next.js project with Turbopack
- Install
libsodium-wrappers: npm install libsodium-wrappers
- Import and use libsodium-wrappers in any component or API route
- Run
next dev --turbopack
- 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.
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
Environment
node -v)Steps to Reproduce
libsodium-wrappers:npm install libsodium-wrappersnext dev --turbopackExpected 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 devinstead ofnext dev --turbopack) works correctly.Additional Context
The
libsodium-wrapperspackage uses dynamic imports and WASM files that Turbopack may not be handling correctly. The standard webpack bundler in Next.js resolves this without issues.