Please help. I am trying to import a typescript module in a worker in the same git repo.

https://github.com/ymolists/sbox-cflare/blob/main/server/package.json#L10 this ๐Ÿ‘† is how i am trying to import this typescript module in the same git repo. Can anyone please tell me what i am doing droing ? Here is the error i get when i try to run wrangler dev
โœ˜ [ERROR] Could not resolve "shared"

src/worker.ts:11:22:
11 โ”‚ import {Greet01} from "shared"
โ•ต ~~~~~~~~

You can mark the path "shared" as external to exclude it from the bundle, which will remove this error.


โœ˜ [ERROR] Build failed with 1 error:

src/worker.ts:11:22: ERROR: Could not resolve "shared"
โœ˜ [ERROR] Could not resolve "shared"

src/worker.ts:11:22:
11 โ”‚ import {Greet01} from "shared"
โ•ต ~~~~~~~~

You can mark the path "shared" as external to exclude it from the bundle, which will remove this error.


โœ˜ [ERROR] Build failed with 1 error:

src/worker.ts:11:22: ERROR: Could not resolve "shared"
GitHub
sbox-cflare/package.json at main ยท ymolists/sbox-cflare
Contribute to ymolists/sbox-cflare development by creating an account on GitHub.
4 Replies
somoni
somoniOPโ€ข2y ago
I confirmed that if i am using a single ts file then my import works. However in this case i am trying to import a function that is defined in a separate file. What is the recomended way to be able to import any function exported from that shared module ?
Unknown User
Unknown Userโ€ข2y ago
Message Not Public
Sign In & Join Server To View
somoni
somoniOPโ€ข2y ago
Hi @kynsonszetau . i swear i thought i did that .. and now works !!! Thanks for the suggestion !
Unknown User
Unknown Userโ€ข2y ago
Message Not Public
Sign In & Join Server To View
Want results from more Discord servers?
Add your server