jurassic icon indicating copy to clipboard operation
jurassic copied to clipboard

How to execute loading module by require?

Open lhf552004 opened this issue 5 years ago • 1 comments

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");

image image

lhf552004 avatar Aug 14 '20 03:08 lhf552004

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

paulbartrum avatar Aug 14 '20 03:08 paulbartrum