Skip to content

Cannot build with URL.canParse function #65412

@Semanual

Description

@Semanual

Link to the code that reproduces this issue

https://github.com/Semanual/canparse_github_issue

To Reproduce

  1. Run npm run build
  2. It throws an error "Property 'canParse' does not exist"

Current vs. Expected behavior

Current:
An error is thrown, as if function URL.canParse didn't exist.

Expected:
Should build with no problems, as per mozilla docs this function is built-in.

Provide environment information

Operating System:
  Platform: linux
  Arch: x64
  Version: #44~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Mon May 22 13:39:36 UTC 2
  Available memory (MB): 15852
  Available CPU cores: 16
Binaries:
  Node: 22.1.0
  npm: 10.7.0
  Yarn: 1.22.19
  pnpm: N/A
Relevant Packages:
  next: 14.3.0-canary.40 // Latest available version is detected (14.3.0-canary.40).
  eslint-config-next: N/A
  react: 18.3.1
  react-dom: 18.3.1
  typescript: 5.1.3
Next.js Config:
  output: N/A

Which area(s) are affected? (Select all that apply)

Not sure

Which stage(s) are affected? (Select all that apply)

next build (local)

Additional context

I tested with next dev too, and it works as expected. For some reason, it only gives this error in next build.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue was opened via the bug report template.locked

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions