Skip to content

8.0.0 fails to use esm in node #144

Closed
@hugomrdias

Description

@hugomrdias

the dual packaging setup does not support esm version in node and cjs version does not do named exports correctly

import { getBIP44AddressKeyDeriver } from '@metamask/key-tree';
         ^^^^^^^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'getBIP44AddressKeyDeriver' not found. The requested module '@metamask/key-tree' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from '@metamask/key-tree';
const { getBIP44AddressKeyDeriver } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

More information about dual packaging here https://github.com/sheremet-va/dual-packaging.

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