dnt icon indicating copy to clipboard operation
dnt copied to clipboard

Code broken by import-meta-ponyfill-esmodule

Open rotu opened this issue 3 months ago • 0 comments

When trying to prepare a package with dnt, I found an error like "TypeError: globalThis[Symbol.for(...)] is not a function"

It seems to have been caused by this code:

const ProxiedStruct = function (
  ...args: ConstructorParameters<typeof Struct>
) {
  return Reflect.construct(Struct, args, new.target)
}

Getting transformed to:

const ProxiedStruct = function (...args) {
    return Reflect.construct(Struct, args, globalThis[Symbol.for("import-meta-ponyfill-esmodule")](import.meta));
};

rotu avatar Oct 11 '25 09:10 rotu