Skip to content

docs: loader hooks don't resolve jsr:/npm:/https: specifiers#3405

Merged
bartlomieju merged 3 commits into
mainfrom
docs/loader-hooks-external-specifiers
Jul 9, 2026
Merged

docs: loader hooks don't resolve jsr:/npm:/https: specifiers#3405
bartlomieju merged 3 commits into
mainfrom
docs/loader-hooks-external-specifiers

Conversation

@bartlomieju

Copy link
Copy Markdown
Member

The Loader hooks reference didn't mention that external specifiers introduced
by hook-emitted source aren't resolved automatically. This trips people up when
they use a load hook to transpile a custom format (e.g. Civet, CoffeeScript)
whose output imports an npm or jsr package.

The reason is that Deno discovers and installs dependencies by statically
analyzing the module graph before execution, whereas hook-generated source is
produced at load time, after that analysis has finished. A bare jsr:, npm:,
or https: import that only appears in the emitted source is therefore invisible
to dependency resolution and fails with an error like
Could not find constraint 'lodash-es@latest' in the list of packages.

This adds an info box to the Custom transpilation use case documenting the
limitation, explaining why it happens, and showing the workaround of declaring
the dependency in deno.json up front. This is working as designed, so the docs
should set the expectation.

Refs denoland/deno#35896

@bartlomieju
bartlomieju merged commit 295b20c into main Jul 9, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant