esm-dev / esm.sh

A fast, smart, & global CDN for modern(es2015+) web development.
https://esm.sh
MIT License
2.97k stars 146 forks source link

`?external` regression in v88 #383

Open kidonng opened 1 year ago

kidonng commented 1 year ago

Culprit may be 830c6ea644aa47f246aa46a1d36215c2e50775fb?

$ # v87 - working
$ curl -si 'https://esm.sh/@primer/octicons-react@17.3.0?target=es2021&alias=react:dom-chef&external=dom-chef&pin=v87' | grep x-typescript-types
x-typescript-types: https://esm.sh/v87/@primer/octicons-react@17.3.0/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/dist/index.d.ts
$ curl https://esm.sh/v87/@primer/octicons-react@17.3.0/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/dist/index.d.ts | head -n 1
import * as React from 'https://esm.sh/v87/dom-chef@5.1.0/X-ZS9kb20tY2hlZg/index.d.ts'

$ # v88 - not working
$ curl -si 'https://esm.sh/@primer/octicons-react@17.3.0?target=es2021&alias=react:dom-chef&external=dom-chef&pin=v88' | grep x-typescript-types
x-typescript-types: https://esm.sh/v88/@primer/octicons-react@17.3.0/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/dist/index.d.ts
$ curl https://esm.sh/v88/@primer/octicons-react@17.3.0/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/dist/index.d.ts | head -n 1
import * as React from 'https://esm.sh/v88/@types/react@18.0.17/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/index.d.ts'

$ # v89 - not working
$ curl -si 'https://esm.sh/@primer/octicons-react@17.3.0?target=es2021&alias=react:dom-chef&external=dom-chef&pin=v89' | grep x-typescript-types
x-typescript-types: https://esm.sh/v89/@primer/octicons-react@17.3.0/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/dist/index.d.ts
$ curl https://esm.sh/v89/@primer/octicons-react@17.3.0/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/dist/index.d.ts | head -n 1
import * as React from 'https://esm.sh/v89/@types/react@18.0.15/X-YS9yZWFjdDpkb20tY2hlZgplL2RvbS1jaGVm/index.d.ts'
ije commented 1 year ago

thanks, i will look into it

KyleJune commented 1 year ago

I found another regression in v88 related to imports without using ?external. It appears to be related to the _interopDefault and _interopNamespace functions. In the linked example the module originally only had default on it, then it got wrapped in a new object with it as the default, it became {default:default:{...}}.

https://github.com/ije/esm.sh/issues/395