Cannot set property x of #<Object> which has only a getter
DmitryScaletta opened this issue · 0 comments
DmitryScaletta commented
Impress and Node.js versions
impress: 3.0.13, node: v21.1.0
Platform
No response
Describe the bug
First the module loader loads the main package which imports a relations
module which exports a relations
function.
node_modules/drizzle-orm/index.cjs
node_modules/drizzle-orm/relations.cjs
Then it tries to load a relations
submodule (the same name as the function that was already loaded).
So lib[subName]
is already exists and it points to the same object as sub.relations
.
I added this debug code here:
Lines 57 to 58 in 4cabe81
const sub = appRequire(name + '/' + subName);
if (name === 'drizzle-orm' && subName === 'relations') {
console.log(lib[subName] && (lib[subName] === sub[subName])); // true
}
lib[subName] = sub; // the error is here
TypeError: Cannot set property relations of #<Object> which has only a getter
at loadModule (node_modules\impress\lib\deps.js:63:24)
at Object.<anonymous> (node_modules\impress\lib\deps.js:89:13)
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 Module.require (node:internal/modules/cjs/loader:1235:19)
at require (node:internal/modules/helpers:176:18)
at Object.<anonymous> (node_modules\impress\lib\planner.js:3:32)
at Module._compile (node:internal/modules/cjs/loader:1376:14)
sql
submodule is also have this problem.
To Reproduce
- Run
npm i drizzle-orm@0.29.0
- Run
npm start
- See a module loading error
Expected behavior
No response
Screenshots
No response
Additional context
All drizzle-orm
's transpiled code can be found here: https://www.npmjs.com/package/drizzle-orm?activeTab=code