denoland / deno

A modern runtime for JavaScript and TypeScript.
https://deno.com
MIT License
94.66k stars 5.25k forks source link

Error importing npm modules from a remote module #16218

Closed oscarotero closed 1 year ago

oscarotero commented 1 year ago

Hi there.

When I run a remote module that imports a npm module, I get a weird error. For example:

deno run --unstable https://deno.land/x/lume@v1.12.0/deps/markdown_it.ts 

error: Remote modules are not allowed to import local modules. Consider using a dynamic import instead.
  Importing: npm:markdown-it-attrs@4.1.3
    at https://deno.land/x/lume@v1.12.0/deps/markdown_it.ts:2:44

The previous version of this file import the same modules from jspm.dev instead of npm: and it works fine:

deno run --unstable https://deno.land/x/lume@v1.11.4/deps/markdown_it.ts 
dsherret commented 1 year ago

I opened https://github.com/denoland/deno_graph/pull/186 but it's a pending discussion on whether we want to allow this (I think we definitely should). I'm marking this as a bug because the error message right now is not nice.

dsherret commented 1 year ago

This is fixed now, but it requires the --unstable flag. Note that there is one bug (#17136) which will be resolved in the next patch release.