Skip to content

How do I use this library? #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
panzi opened this issue Jul 7, 2021 · 0 comments
Open

How do I use this library? #1

panzi opened this issue Jul 7, 2021 · 0 comments

Comments

@panzi
Copy link

panzi commented Jul 7, 2021

If I try to import { decode as b45decode } from 'base45-ts'; I just get this when I try to run the compiled program:

node:internal/modules/cjs/loader:1125
      throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath);
      ^

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /home/panzi/job/git/ehcjs/node_modules/base45-ts/lib/base45.js
require() of ES modules is not supported.
require() of /home/panzi/job/git/ehcjs/node_modules/base45-ts/lib/base45.js from /home/panzi/job/git/ehcjs/dist/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename base45.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/panzi/job/git/ehcjs/node_modules/base45-ts/package.json.

    at new NodeError (node:internal/errors:363:5)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1125:13)
    at Module.load (node:internal/modules/cjs/loader:988:32)
    at Function.Module._load (node:internal/modules/cjs/loader:828:14)
    at Module.require (node:internal/modules/cjs/loader:1012:19)
    at require (node:internal/modules/cjs/helpers:93:18)
    at Object.<anonymous> (/home/panzi/job/git/ehcjs/dist/index.js:8:21)
    at Module._compile (node:internal/modules/cjs/loader:1108:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
    at Module.load (node:internal/modules/cjs/loader:988:32) {
  code: 'ERR_REQUIRE_ESM'
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant