jspm / project

Roadmap and management repo for the jspm project
161 stars 8 forks source link

Cannot resolve https://ga.jspm.io/npm:react@18.2.0/jsx-runtime (unless you add .js) #230

Closed haikyuu closed 1 year ago

haikyuu commented 1 year ago

When using esbuild with automatic transform, it tries to resolve react/jsx-runtime. But it fails in jspm even though the resolution should work since it's correctly specified in React's package.json.

guybedford commented 1 year ago

The ga.jspm.io CDN is an import map CDN - the import map is used to resolve the "exported subpath" of the package to a final module URL. This is done via the JSPM generator project which will generate the correct mappings into an import map. Eg see https://generator.jspm.io/#U2NgYGBkLM3ULc5IzclhKEpNTC5xMLTQM9Iz0M8qrtAtKs0rycxNBQC25xIlJwA.

If you want an easy browser workflow that does what you expect you can access https://jspm.dev/react/jsx-runtime as well, but in general import maps are preferred for performance and better caching since all URLs are uniquely cached.

haikyuu commented 1 year ago

Thanks @guybedford Yes indeed. It works as expected, I had an issue somewhere else *