jurassic
jurassic copied to clipboard
How to execute loading module by require?
Hi, I'm going to load a module below:
var lunrMutable = require('lunr-mutable-indexes');
But I don't know how to load this module correctly.
My steps is load a single file /lunr-mutable-indexes/lunr-mutable.js
But it is failed. The problem is this module is not a single file, besides it would load another module inside it. For example it would load lunr module.
engine = new Jurassic.ScriptEngine();
engine.ExecuteFile("lib/require.js/require.min.js");
engine.ExecuteFile("lib/lunr.js/lunr.js");
//engine.Execute("var lunrMutable = require('lunr-mutable-indexes');");
engine.ExecuteFile("lib/lunr-mutable-indexes/lunr-mutable.js");

require() is a node.js-specific thing I think. There's a standard (ECMAScript) replacement called "import" but Jurassic doesn't support that either :-(