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

module resolve failed with dynamic import and circulated import #3736

Closed
Fenzland opened this issue Jan 21, 2020 · 2 comments · Fixed by #11089
Closed

module resolve failed with dynamic import and circulated import #3736

Fenzland opened this issue Jan 21, 2020 · 2 comments · Fixed by #11089
Assignees
Labels
bug Something isn't working correctly

Comments

@Fenzland
Copy link
Contributor

Files like this:

// index.js
import ('./b.js');
import ('./a.js');
// a.js
import './b.js';
// b.js
import './c.js';
import './a.js';
// c.js
import './d.js';
// d.js

Then lets run with

deno --allow-read index.js

It crash with:

error: Uncaught Cannot resolve module "./d.js" from "file:///tmp/c.js"

Let's edit b.js to this

// b.js
import './a.js';
import './c.js';

Then run

deno --allow-read index.js

It crash with:

error: Uncaught Cannot resolve module "./c.js" from "file:///tmp/b.js"
  • when we dynamically import b.js and a.js in index.js concurrently, and b.js first;
  • and a.js and b.js statically import each other;
  • then we cannot statically import anything in b.js after import a.js.
  • and we cannot statically import anything in c.js that imported by b.js before b.js import a.js.
// b.js
import './a.js';
// cannot statically import anything here
// c.js
// cannot statically import anything here

This BUG exists since we support import(). I've encountered it several times.
The first time is under 0.15 or 0.16. Today I, finally find out how to reproduce it.

@bartlomieju bartlomieju added the bug Something isn't working correctly label Feb 5, 2020
@bartlomieju bartlomieju self-assigned this Feb 24, 2020
@lucacasonato
Copy link
Member

@Fenzland Can you still reproduce this? This might have been resolved by the module graph refactor @bartlomieju did a while ago.

@bartlomieju
Copy link
Member

It was not, this error is still valid. Waiting on modules refactor in core/ by @piscisaureus

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly
Projects
None yet
4 participants