Next.js Discord

Discord Forum

SyntaxError: Cannot use import statement outside a module `@jpg-store/lucid-cardano`

Unanswered
Cornish Rex posted this in #help-forum
Open in Discord
Cornish RexOP
Hey, community. I'm getting this error while running next dev after updating from Next.js 14.1.1 to 14.2.18.

/Users/juliojordan/monorepo/node_modules/.pnpm/@jpg-store+lucid-cardano@0.9.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@jpg-store/lucid-cardano/esm/src/core/wasm_modules/cardano_multiplatform_lib_nodejs/cardano_multiplatform_lib.js:1
import * as dntShim from "../../../../_dnt.shims.js";
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:128:18)
    at wrapSafe (node:internal/modules/cjs/loader:1280:20)
    at Module._compile (node:internal/modules/cjs/loader:1332:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1427:10)
    at Module.load (node:internal/modules/cjs/loader:1206:32)
    at Module._load (node:internal/modules/cjs/loader:1022:12)
    at cjsLoader (node:internal/modules/esm/translators:366:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:315:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:323:24)


Seems like Next.js takes care of the @jpg-store/lucid-cardano package automagically.

Next.js includes a short list of popular packages that currently are working on compatibility and automatically opt-ed out:
...
@jpg-store/lucid-cardano

I added the @jpg-store/lucid-cardano package to the transpilePackages config option and got this error instead.

⨯ ../../node_modules/.pnpm/@jpg-store+lucid-cardano@0.9.1_bufferutil@4.0.8_utf-8-validate@5.0.10/node_modules/@jpg-store/lucid-cardano/esm/src/core/wasm_modules/cardano_message_signing_web/cardano_message_signing.js:3115:17
Module not found: Can't resolve 'cardano_message_signing_bg.wasm'

I'm sure I'm missing something here. I'll appreciate any help.

0 Replies