Imports and Exports
To learn how imports and exports work in Deno, see Deno's documentation on ECMAScript Modules (opens in a new tab).
🦕 The high-level takeaways are:
- Deno uses the ECMAScript 6Â
import/export
standard - Deno uses browser-like module resolution, meaning that file names must be specified in full (including the file extension)
- You can import remote modules with just a URL. There is no
package.json
file. - You can import most NPM modules via Deno-friendly CDNs. See documentation on "npm via CDNs" (opens in a new tab).
In Zipper, you can add files to your applet that do not export a handler function. Doing this treats these files as library files which you can import in other files within the same applet.
Remote imports
As mentioned above, remote modules can be imported from a URL. The most foolproof way to import a package is via deno.land/x (opens in a new tab). If the package you're looking for doesn't exist on deno.land, there are a number of Deno-friendly CDNs that you can use to import NPM modules (such as skypack.dev (opens in a new tab)). If you hit any issues importing a package, contact Zipper to let us know.