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

The windows logic in std/path breaks in DNT #5468

Closed
oscarotero opened this issue Jul 17, 2024 · 2 comments · Fixed by #5478
Closed

The windows logic in std/path breaks in DNT #5468

oscarotero opened this issue Jul 17, 2024 · 2 comments · Fixed by #5478
Labels
bug Something isn't working

Comments

@oscarotero
Copy link

Describe the bug

I want to publish a package to NPM using DNT. It worked fine until now. After updating @std/path from 0.225.2 to 1.0.0, the build process breaks:

[dnt] Building project...
[dnt] Type checking ESM...
src/deps/jsr.io/@std/path/1.0.0/_os.ts:25:6 - error TS2304: Cannot find name 'navigator'.

25     (navigator.userAgent.includes("Win") ? "windows" : "linux");
        ~~~~~~~~~

error: Uncaught (in promise) Error: Had 1 diagnostics.
          throw new Error(`Had ${diagnostics.length} diagnostics.`);
                ^
    at getProgramAndMaybeTypeCheck (https://jsr.io/@deno/dnt/0.41.2/mod.ts:468:17)
    at build (https://jsr.io/@deno/dnt/0.41.2/mod.ts:354:17)
    at eventLoopTick (ext:core/01_core.js:168:7)
    at async file:https:///Users/oscarotero/www/ventojs/vento/_scripts/build_npm.ts:12:1

Steps to Reproduce

  1. Clone the repository https://github.com/ventojs/vento
  2. Run deno task build-npm 1.12.10

Expected behavior

The build is done successfully

Environment

@oscarotero oscarotero added bug Something isn't working needs triage labels Jul 17, 2024
@iuioiua
Copy link
Collaborator

iuioiua commented Jul 18, 2024

This is likely an issue with the build script. Try adding lib: ["ESNext", "DOM"] to your compilerOptions parameter. Please feel free to re-open if this issue persists.

@iuioiua iuioiua closed this as completed Jul 18, 2024
@kt3k
Copy link
Member

kt3k commented Jul 18, 2024

It seems we used to cast globalThis to any before accessing to navigator https://github.com/denoland/std/blob/release-2024.06.03/path/_os.ts#L27

DNT probably checks types with @types/node settings. (Deno and DOM both have global navigator)

I think this is probably a Node.js compat issue.

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

Successfully merging a pull request may close this issue.

3 participants