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

Loader fails when circular dependencies exist within an application #32

Open
bizob2828 opened this issue Sep 13, 2023 · 3 comments
Open

Comments

@bizob2828
Copy link

bizob2828 commented Sep 13, 2023

Expected Behavior

When running an application that has circular deps with import-in-the-middle, it should handle this accordingly.

Actual Behavior

It silently fails in pre Node 20, and in Node 20 errors with

file:///Users/revans/code/cyclic-loader-issue/dep-2.js:5
  dep1()
  ^

ReferenceError: Cannot access 'dep1' before initialization
    at dep2 (file:///Users/revans/code/cyclic-loader-issue/dep-2.js:5:3)
    at file:///Users/revans/code/cyclic-loader-issue/dep-1.js:7:1
    at ModuleJob.run (node:internal/modules/esm/module_job:217:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:308:24)
    at async loadESM (node:internal/process/esm_loader:42:7)
    at async handleMainPromise (node:internal/modules/run_main:66:12)

Steps to Reproduce the Problem

  1. git clone https://github.com/bizob2828/cyclic-loader-issue
  2. npm i && npm run start

Specifications

  • Version: Node 16,18,20.
  • Platform: All
  • Subsystem: All
@mjsalinger
Copy link

Hi - is there any chance on solving this?

@timfish
Copy link
Contributor

timfish commented Jun 28, 2024

Confirmed this is still an issue with v1.8.1

@jsumners-nr
Copy link
Contributor

Hi - is there any chance on solving this?

Pull requests are welcome.

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

4 participants