Please help. I am trying to import a typescript mo...
# workers-help
s
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
Copy code
✘ [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"
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 ?
k
Not sure if it is the best/ recommended way, but maybe you can try to update the “main” field in shared/package.json to “./src/index.ts”
Then run
npm install
you should see shared gets linked in node_module