Closed nitsky closed 3 years ago
I'd really like to be able to import tangram from "@tangramdotdev/tangram";
in an ES6 module. Hopefully this feature will happen.
As of v0.7.0 you can import * as tangram from "@tangramdotdev/tangram";
in an ES Module with Node.js v14 or later, so long as you set "type": "module"
in your package.json
. In the browser, you can import * as tangram from "https://js.tangram.xyz";
, and in deno you import * as tangram from "https://js.tangram.xyz/deno";
.
@yesmar does this satisfy what you are looking for?
Yes, that totally works. I must have missed it in the docs. Thanks!
@yesmar the docs use require
for maximum compatibility, but the examples in the repo use es modules because they have their own package.json
s so they can specify the type
key.
The JavaScript library currently has support for Node.js and bundlers. We should be able to add support for Deno and native ES modules like so: