Open
Description
When I attempt to import 'gun/lib/time.js'
within Node.js, I encounter the following error. Here is a minimal reproducible example:
{
"dependencies": {
"gun": "^0.2020.1239"
},
"type": "module"
}
import Gun from 'gun/gun.js';
import 'gun/lib/time.js';
$ npm i
$ node example.js
Hello wonderful person! :) Thanks for using GUN, please ask for help on http://chat.gun.eco if anything takes you longer than 5min to figure out!
REDACTED/node_modules/gun/lib/time.js:3
var ify = Gun.node.ify, u;
^
TypeError: Cannot read properties of undefined (reading 'ify')
at REDACTED/node_modules/gun/lib/time.js:3:21
at Object.<anonymous> (REDACTED/node_modules/gun/lib/time.js:138:2)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at cjsLoader (node:internal/modules/esm/translators:345:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
Node.js v20.10.0
This error occurs both when importing using the require
and import
syntax. Additionally, the error persists when attempting to import 'gun'
instead of 'gun/gun.js'
. However, it does not occur when running the code in the browser using a script tag to import gun as shown below:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<script src="./node_modules/gun/gun.js"></script>
<script src="./node_modules/gun/lib/time.js"></script>
<script>
console.log(Gun().time);
</script>
</body>
</html>
Metadata
Metadata
Assignees
Labels
No labels