forge icon indicating copy to clipboard operation
forge copied to clipboard

`TypeError` due to `URL(window.location.href)` after upgrading to node-forge 1.3.1

Open elshadsm opened this issue 7 months ago • 0 comments

Environment:

Project type: Tabris.js (hybrid mobile framework using JavaScript)

Node version: 22.15.0

node-forge version: upgrading from 0.7.6 to 1.3.1

Problem:

After upgrading node-forge from version 0.7.6 to 1.3.1, the application fails to load and throws the following runtime error:

Could not load main module: TypeError: undefined is not a constructor (evaluating 'new URL(window.location.href)')
     at js (./dist/index.js:2126:5)
     at __webpack_require__ (./dist/index.js:6992:46)

This happens because window.location.href is not available in the Tabris.js runtime. These are browser-specific APIs and do not exist in Tabris.js or other hybrid environments.

The older version 0.7.6 works fine.

Expected Behavior:

The library should check if the environment supports these before using them. Please consider making the library more compatible with hybrid runtimes like Tabris.js.

elshadsm avatar Jul 03 '25 15:07 elshadsm