DenoDDeno
Powered by
staytuned_teamS
Deno•17mo ago•
6 replies
staytuned_team

Issue with deno emit bundle in Workspaces - Need Help and Documentation

Hi everyone,

I'm having trouble with deno emit bundle function, when my project is in workspaces. It seems like the bundling process doesn't support workspaces. Has anyone encountered this issue before and can provide an example of how to handle this use case? Are there any official docs available that address this?

taking example from the official deno workspace docs: https://docs.deno.com/runtime/fundamentals/workspaces/
and deno/emit docs: https://jsr.io/@deno/emit

after creating the files mentioned in the doc, i.e.:
/
├── deno.json
├── main.ts
├── add/
│     ├── deno.json
│     └── mod.ts
└── subtract/
      ├── deno.json
      └── mod.ts
/
├── deno.json
├── main.ts
├── add/
│     ├── deno.json
│     └── mod.ts
└── subtract/
      ├── deno.json
      └── mod.ts

add two files
1. import_map.json
2. bundle.ts

// bundle.ts:
import { bundle } from "jsr:@deno/emit";
const result = await bundle(
  "./main.ts",
  {
    importMap: "./import_map.json"
  }
);

const { code } = result;
console.log(code);
import { bundle } from "jsr:@deno/emit";
const result = await bundle(
  "./main.ts",
  {
    importMap: "./import_map.json"
  }
);

const { code } = result;
console.log(code);


the following error occures which bundling:

error: Uncaught (in promise) Error: Unable to output during bundling: load_transformed failed: failed to analyze module: failed to resolve @scope/add from file:///C:/Users/ASUS/Downloads/emit/main.ts: Cannot resolve "@scope/add" from "file:///C:/Users/ASUS/Downloads/emit/main.ts".
error: Uncaught (in promise) Error: Unable to output during bundling: load_transformed failed: failed to analyze module: failed to resolve @scope/add from file:///C:/Users/ASUS/Downloads/emit/main.ts: Cannot resolve "@scope/add" from "file:///C:/Users/ASUS/Downloads/emit/main.ts".


Thanks in advance for your help!
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Deno Emit
slabcacheSslabcache / help
3y ago
nodeModulesDir with deno workspaces
cameronmCcameronm / help
2y ago
Workspaces with deno deploy
jhJjh / help
2y ago
Bundle ts code to ts using deno emit
KayKKay / help
2y ago