Deno Fresh: TypeError: 'import', and 'export' cannot be outside of module
Deno Fresh:
I'm trying to use a mapping library ES module @arcgis/core, but it gives the following error. Am i missing a type definition or something else?:
3 Replies
That looks like a bug in Deno's node compatibility layer. I've filed an issue for that https://github.com/denoland/deno/issues/23059
GitHub
Bug: ESM module incorrectly detected as CJS · Issue #23059 · denola...
Steps to reproduce: Run this snippet: import Bookmarks from "npm:@arcgis/core@4.29/widgets/Bookmarks.js"; console.log(Bookmarks); Error: error: 'import', and 'export' cann...
Ok turns out that this is not a bug in Deno, but a broken npm package. They say that the package is written in commonjs but ship ESM instead.
Oh I see. Thanks for the investigation!