Open yoh1496 opened 3 years ago
@yoh1496 Thank you for creating a Pull Request. Please let me confirm the behavior after the correction just in case. My understanding is as follows, is it correct?
// The following code works
const util = require("testCommon");
// The following code does not work
const util = require("./testCommon");
// The following code does not work
const util = require("testCommon");
// The following code works
const util = require("./testCommon");
As you said, I think require(./testCommon)
is correct in CommonJS.
Yes, you are right.
But the main part of change is switching Require
module which is hand-made in Personium community to Rhino module.
This PR make you be able to use commonjs features. But it contains imcompatibility with old version. Please review carefully.
Before
You have to write module name to import your engine script. For example,
And the imported script must be written in "Engine Script" specific rules.
After
You can write import line like below.
And you can write script in common rules.