require1k
require1k copied to clipboard
Exports object does not contains modules
This sample in the readme does not works.
<script>
R(function (require, module, exports) {
var index = require("./index");
exports.hello = "World!"
}, function (err, exports) {
if (err) {
console.error(err.statusText);
return;
}
console.log(exports.hello)
});
</script>
This one works well 👍
<script>
R(function (require, module, exports) {
var index = require("./index");
exports.exports.hello = "World!"; // Here it is attached to the good object.
}, function (err, exports) {
if (err) {
console.error(err.statusText);
return;
}
console.log(exports.hello)
});
</script>
Solutions : Modify the readme OR Modify the source code.