Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Importing local bundle tries to import from path prefixed with denoland URL #2

Closed
dergyitheron opened this issue Jan 27, 2022 · 2 comments

Comments

@dergyitheron
Copy link

I have simple folder structure:

  • deps.js - bundle which exports Abort
  • main.ts - file where I create worker and try to import Abort from deps.js
new Thread(fetcher, "module", ['import { Abort } from "./deps.js";'])
    .postMessage(config)
    .onMessage(handleResults);

Error I'm getting when running deno run --allow-read --allow-net main.ts

Download https://deno.land/x/Thread@v3.0.0/deps.js
error: Uncaught (in promise) TypeError: Module not found "https://deno.land/x/Thread@v3.0.0/deps.js".
      let x = await import(fqfn); //Deno.realPathSync(fqfn)
              ^
    at async Thread.copyDep (https://deno.land/x/Thread@v3.0.0/Thread.ts:85:15)
    at async https://deno.land/x/Thread@v3.0.0/Thread.ts:42:58
    at async Promise.all (index 0)
    at async Thread.populateFile (https://deno.land/x/Thread@v3.0.0/Thread.ts:44:8)

I was trying to find why it's trying to import from https://deno.land/x/Thread@v3.0.0/deps.js but no clue. It seams to be happening here but I don't know how to debug Deno import.

I basically just followed this example.

Is this possible or am I doing something wrong?

@duart38
Copy link
Owner

duart38 commented Jan 28, 2022

Hey there @dergyitheron , i've been looking into this and it seems like importing from the github RAW url or using a local copy seems to work fine. for some reason using the denoland url fails tho..

For now (if feasible), you can use the following:

// import Thread from "https://deno.land/x/Thread@v3.0.0/Thread.ts"; // does not work
import Thread from "https://raw.githubusercontent.com/duart38/Thread/master/Thread.ts" // works
// import Thread from "http://127.0.0.1:8080/Thread.ts" // works
// import Thread from "./Thread.ts" // works

You may remove the commented ones that do not work.

@dergyitheron
Copy link
Author

dergyitheron commented Feb 1, 2022

Hi @duart38 , using raw github link is working fine, I can go on with that.

I will try to find out why is denoland link not working and update here if I find anything.

Thank you anyway! Your library is great!

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

No branches or pull requests

2 participants