Skip to content

cardano_serialization_lib_bg.js use require() #734

@tobby1464

Description

@tobby1464

I am using the cardano serialization lib with NextJS in a client component, and see this error:
./node_modules/@emurgo/cardano-serialization-lib-browser/cardano_serialization_lib_bg.js (38974:17)
Module not found: Can't resolve
38972 |
38973 | export function __wbg_require_0993fe224bf8e202(arg0, arg1) {

38974 | const ret = require(getStringFromWasm0(arg0, arg1));
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
38975 | return addHeapObject(ret);
38976 | };
38977 |

After some searching, it seems that the require() statement is not natively supported in browsers.

Versions of interest:
"@emurgo/cardano-serialization-lib-browser": "^14.1.2"
"next": "15.3.3"

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