Closed keller-mark closed 1 year ago
Related to https://github.com/mapbox/tiny-sdf/issues/53 (I believe the DeckGL package.json are the root issue, not the @mapbox/tiny-sdf
package.json)
deck.gl v8.x is not a ESM module, i.e. you cannot import
it directly in Nodejs. This is not a bug.
Refer to #8187 for v9.0 plans.
Hi @Pessimistress, thanks for the information. It appears the link to the v9 plans is broken, would you be able to share a new link?
It's just a link to the other issue you created.
Ah sorry for the confusion, I was expecting a v9 roadmap - is that type of document/issue available?
v9 has been published with "type": "module"
and a package.json#exports
entry:
https://unpkg.com/@deck.gl/core@9.0.1/package.json
Related:
Description
Hi, I am using DeckGL in my web application. I am running into issues when importing DeckGL (directly or indirectly) in unit testing frameworks which execute code using NodeJS (
vitest
in particular) because the package.json fordeck.gl
(as well as for@deck.gl/*
):"type": "module"
and"module": "dist/esm/index.js"
does not end in.mjs
This is also clear when checking
deck.gl
in Publint: https://publint.dev/deck.gl@8.9.30This issue might not have previously been reported if all DeckGL sub-dependencies had CJS equivalents. However it appears that relatively recently at least one sub-dependency (
@mapbox/tiny-sdf
) is published as ESM-only which is causing this issue to be detected.Flavors
Expected Behavior
Expect either:
"type": "module"
in package.json (fordeck.gl
and@deck.gl/*
)OR
.mjs
extensions to signal to NodeJS that the contents are ESM ("module": "dist/esm/index.mjs"
)Also, expect Publint to pass without warnings/errors.
Also, expect
exports
field of package.json to be defined for usage by NodeJS.Steps to Reproduce
https://stackblitz.com/edit/vitejs-vite-fxr3cz?file=src%2Fdeckgl.test.js
npm run test
in the Terminal on StackblitzEnvironment
deck.gl@8.9.30
18.16.0
Logs