esm.sh icon indicating copy to clipboard operation
esm.sh copied to clipboard

Static CJS exports not detected - @nodefill/primordials

Open jcbhmr opened this issue 2 years ago • 3 comments

Failing module

  • GitHub: https://github.com/nodefill/primordials
  • npm: https://npmjs.com/package/@nodefill/primordials
import { ArrayPrototypePush } from "https://esm.sh/@nodefill/primordials"

Error message

After onload I got this:

Uncaught SyntaxError: The requested module 'https://esm.sh/@nodefill/primordials' does not provide an export named 'ArrayPrototypePush' (at data:text/javascript,import { ArrayPrototypePush } from "https://esm.sh/@nodefill/primordials":1:10)

Additional info

  • esm.sh version: v128
  • Browser version: Chrome 114

Node.js Deno detect the named exports just fine:

also posted to https://github.com/jsdelivr/jsdelivr/issues/18512

jcbhmr avatar Jul 13 '23 06:07 jcbhmr

https://github.com/nodefill/primordials/releases/tag/v3.1.0 I made it work with esm.sh by manually duplicating the export names so that it got picked up by the CJS lexer. However, this still doesn't recognize eval which should work...

// SYNTAX ERROR: doesn't provide "eval" as named export
import { eval as eval2 } from "https://esm.sh/@nodefill/primordials"
// works in Node.js
import { eval as eval2 } from "@nodefill/primordials"

jcbhmr avatar Jul 13 '23 19:07 jcbhmr

v130 should fix

ije avatar Jul 28 '23 17:07 ije

Almost. The named eval export still fails.

image

jcbhmr avatar Jul 28 '23 20:07 jcbhmr