oframe / ogl

Minimal WebGL Library
https://oframe.github.io/ogl/examples
3.77k stars 213 forks source link

Cannot find index.js with unpkg CDN #173

Closed pschroen closed 1 year ago

pschroen commented 1 year ago

https://unpkg.com/ogl

Cannot find "/index.js" in ogl@0.0.117

This also appears to be breaking the CodeSandbox link in the readme.

https://codesandbox.io/s/ogl-5i69p

gordonnl commented 1 year ago

hm, looks like it ignores the package json "exports": "./src/index.mjs",

pschroen commented 1 year ago

Ya I was worried about those changes we made to the package.json from #138.

@CodyJasonBennett any ideas? ☝️

CodyJasonBennett commented 1 year ago

I'd try adding browser and main for Unpkg and Codesandbox, respectively. main might just be enough. Node will ignore those keys and pick exports instead. For the browser, I'd also drop .mjs which is redundant with "type": "module".

CodyJasonBennett commented 1 year ago

Looks like that was enough. #174

pschroen commented 1 year ago

I see you've also switched to the .js extension there (which I'm in support of too), also discussed in #138.

@gordonnl I don't see any reason to keep the .mjs extension anymore, imho that was popular when modules were first introduced as a stop-gap solution, but it's common practice these days to just name everything .js as ES6 modules are widely supported now by all browsers and runtimes. 😉

CodyJasonBennett commented 1 year ago

FWIW there's https://publint.dev and https://arethetypeswrong.github.io as a sanity check.

gordonnl commented 1 year ago

ooh handy, thanks!