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

Deno compile - module not found on Windows in cjs pkg re-exporting relative path with parent component #24785

Closed
spkier12 opened this issue Jul 29, 2024 · 4 comments · Fixed by #24795
Labels
bug Something isn't working correctly compile related to the `deno compile` feature windows Related to Windows platform

Comments

@spkier12
Copy link

spkier12 commented Jul 29, 2024

Version: Deno 1.45.0 (Latest)
Deno compile certain npm packages casues module not found when executing the .exe after compile

[ERR_MODULE_NOT_FOUND] Cannot find module "C:\Users\Ulrik\AppData\Local\Temp\deno-compile-Simconnect_test.exe\node_modules\localhost\node-simconnect\3.6.2\dist\dto../datastructures/VersionBaseType" imported from "C:\Users\Ulrik\AppData\Local\Temp\deno-compile-Simconnect_test.exe\node_modules\localhost\node-simconnect\3.6.2\dist\dto\index.js""

Command to compile: deno compile -A main.ts --Unstable npm:[email protected]

Here is my code:

import {SystemEvents, MSFS_API, loadAirportDB} from "npm:[email protected]"

const api = new MSFS_API();

let Ramp2TaxiState = true
let ClimbOrCruiseState = false
let DecendState = false
let LandingState = false


api.connect({
    retries: Infinity,
    retryInterval: 2,
    onRetry: (_: any, interval: Number) => {
      console.log(`Connection failed: retrying in ${interval} seconds.`);
    },
    onConnect: async() => await MSFSRun()
  });

// Get events continuerly every 1 second
async function MSFSRun() {
  console.log(`\n Connected to Simconnect`)
  while(true) {
    let x = await api.get("AIRSPEED INDICATED")
    let y = await api.get("PLANE ALTITUDE")
    let z = await api.get("VERTICAL SPEED")
    console.log(`Speed: ${String(x.AIRSPEED_INDICATED).split(".")[0]} ALT: ${String(y.PLANE_ALTITUDE).split(".")[0]} VS: ${String(z.VERTICAL_SPEED * 60).split(".")[0]}`)
    setInterval(() => {}, 800)
  }
}
@marvinhagemeister marvinhagemeister added bug Something isn't working correctly compile related to the `deno compile` feature labels Jul 29, 2024
@dsherret
Copy link
Member

dsherret commented Jul 30, 2024

Deno 1.45.0 (Latest)

Did you try in 1.45.4 (the actual latest)? It might be fixed there.

@spkier12
Copy link
Author

Deno 1.45.0 (Latest)

Did you try in 1.45.4 (the actual latest)? It might be fixed there.

Yes i wrote wrong version in the post i am on latest.

Seems you cannit mix modules and commonjs in deno compile, makes me wonder why they announced npm support when it dosnt work. Seems to be a problem for 40% of npm packages that still uses cjs

@dsherret
Copy link
Member

dsherret commented Jul 30, 2024

Seems you cannit mix modules and commonjs in deno compile, makes me wonder why they announced npm support when it dosnt work. Seems to be a problem for 40% of npm packages that still uses cjs

It's seems to just a Windows thing and the internals of deno compile changed in 1.45.0 to not expose absolute file paths so there might be some bugs related to that.

I was able to only reproduce this on Windows.

@dsherret dsherret added the windows Related to Windows platform label Jul 30, 2024
@spkier12
Copy link
Author

Seems you cannit mix modules and commonjs in deno compile, makes me wonder why they announced npm support when it dosnt work. Seems to be a problem for 40% of npm packages that still uses cjs

It's seems to just a Windows thing and the internals of deno compile changed in 1.45.0 to not expose absolute file paths so there might be some bugs related to that.

I was able to only reproduce this on Windows.

so if i was to downgrade 1 version it would work?
Still worth making a bug report of and why does it noe resolve absolute path?

@dsherret dsherret changed the title Deno compile certain npm packages casues module not found Deno compile - module not found on Windows in cjs pkg re-exporting relative path with parent component Jul 30, 2024
crowlKats pushed a commit that referenced this issue Jul 31, 2024
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 compile related to the `deno compile` feature windows Related to Windows platform
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants