Skip to content
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

node-esm: Dynamic require of "zlib" is not supported #2111

Open
loynoir opened this issue Mar 18, 2022 · 1 comment
Open

node-esm: Dynamic require of "zlib" is not supported #2111

loynoir opened this issue Mar 18, 2022 · 1 comment

Comments

@loynoir
Copy link

loynoir commented Mar 18, 2022

Error

Error: Dynamic require of "zlib" is not supported

Brief

var require_inflation = __commonJS({
  "inflation@2.0.0"(exports, module)  {
    init_esm_shims();
    var zlib = __require("zlib");

Actual

For node-esm environment

var __require = /* @__PURE__ */ ((x) =>
  typeof require !== "undefined"
    ? require
    : typeof Proxy !== "undefined"
    ? new Proxy(x, {
        get: (a, b) => (typeof require !== "undefined" ? require : a)[b],
      })
    : x)(function (x) {
  if (typeof require !== "undefined") return require.apply(this, arguments);
  throw new Error('Dynamic require of "' + x + '" is not supported');
});

Expected

For node-esm environment

import {createRequire} from 'module'

var __require =  requireWrapper(createRequire(import.meta.url))
@loynoir
Copy link
Author

loynoir commented Mar 18, 2022

Related issue
#1921

Related pull
#2067

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