Skip to content

deno bundle fails with multiple [ERR_MODULE_NOT_FOUND] and [ERR_UNSUPPORTED_DIR_IMPORT] errors #30510

@maliknajjar

Description

@maliknajjar

I’m encountering an issue when trying to bundle my Deno project using deno bundle.

Command

deno bundle --output bundle.js src/main.ts

Output

deno bundle is experimental and subject to changes
error: [ERR_MODULE_NOT_FOUND] Cannot find module 'file:///index.js' imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/call-bind/callBound.js'
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/call-bind/callBound.js:3:23
error: Could not find package 'chokidar' from referrer 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/nunjucks/src/node-loaders.js'.
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/nunjucks/src/node-loaders.js:45:27
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/CJSImportProcessor.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/CJSImportProcessor.js:1:30
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/identifyShadowedGlobals.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/identifyShadowedGlobals.js:1:96
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/index.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/index.js:7:22
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/CJSImportTransformer.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/CJSImportTransformer.js:1:76
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/JSXTransformer.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/JSXTransformer.js:2:24
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/ReactDisplayNameTransformer.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/ReactDisplayNameTransformer.js:1:31
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/ReactHotLoaderTransformer.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/transformers/ReactHotLoaderTransformer.js:1:54
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/util/getDeclarationInfo.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/util/getDeclarationInfo.js:1:38
error: [ERR_UNSUPPORTED_DIR_IMPORT] Directory import 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/parser/tokenizer' is not supported resolving ES modules imported from 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/util/getNonTypeIdentifiers.js'
Did you mean to import index.js within the directory?
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/sucrase/dist/esm/util/getNonTypeIdentifiers.js:1:31
error: Could not find package 'source-map-support' from referrer 'file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/typescript/lib/typescript.js'.
    at file:///home/malik446644/Desktop/lobb_project/lobb/node_modules/.deno/[email protected]/node_modules/typescript/lib/typescript.js:8190:20
error: bundling failed

Description

  • I am using a Deno project that relies on Node.js modules (nunjucks, sucrase, etc.) resolved via npm: specifiers.

  • Running deno bundle fails with multiple errors:

    • [ERR_MODULE_NOT_FOUND] when trying to resolve certain packages (e.g., chokidar, source-map-support).
    • [ERR_UNSUPPORTED_DIR_IMPORT] for directory imports inside the sucrase package.
  • The bundling process does not complete successfully.

Expected Behavior

The project should bundle into a single JavaScript file (bundle.js) without these resolution errors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working correctlydeno-bundle

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions