Changing code in custom installed openhab.js - Cannot load CommonJS module

I have made a custom installation of openhab-js. I would like to test some changes which I would like to make inside the automation/js/node_modules/openhab/rules/rules.js file.

When I save the changes I get that the error in the log:

2022-01-07 16:09:27.542 [ERROR] [ipt.internal.ScriptEngineManagerImpl] - Error during evaluation of script 'file:/openhab/conf/automation/js/node_modules/openhab/rules/rules.js': org.graalvm.polyglot.PolyglotException: TypeError: Cannot load CommonJS module: '../items'

this points to this code inside rules.js:

const items = require('../items');

How do I fix this GraalVM error?

when changed to

const items = require('/openhab/conf/automation/js/node_modules/openhab/items');

Things are ok ( running a docker container)

In my experience, you can ignore this GraalVM error, as (AFAIK) it is caused by the issue that the content node_modules directory is loaded as scripts.
When that issue is fixed, the GraalVM error you saw should be gone.

What actually happens on save of rules.js is, that the GraalVM Engine loads rules.js as a script and not as part of the library.
When you make you changes in rules.js and then require the rules namespace from openhab-js in a script in automation/js, everything should work correctly and you should be able to see/use/whatever your changes.

This is true. I just made the mistake that I changed rules.js without changing and submitting my test.js which uses rules.
Doing so it works.
So I can ignore the error messages.