bevry-archive / lazy-require

Sponsor this project to keep it maintained, or use Deno instead.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Using Lazyrequire without installing it with npm

nicolapreda opened this issue · comments

hello, I would need a hand in installing lazyrequire without using npm, as I will have to use it without asking the end user for any installation. I added all the lazyrequire javascript files and various dependencies to my project:
image
but when I try to use the package like this:

'use strict'
var lazyRequire = require('./lazyrequire')

var cp = lazyRequire("child_process");

I receive this error:

     
   throw new Error('You must pass `require` into `lazyrequire(require)`')
        ^
Error: You must pass `require` into `lazyrequire(require)`
    at lazy (C:\Users\nicol\AppData\Local\com.diskxo.yunime\lazyrequire.js:11:15)
    at Object.<anonymous> (C:\Users\nicol\AppData\Local\com.diskxo.yunime\index.js:4:10)
←[90m    at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
←[90m    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)←[39m
←[90m    at Module.load (internal/modules/cjs/loader.js:928:32)←[39m
←[90m    at Function.Module._load (internal/modules/cjs/loader.js:769:14)←[39m
←[90m    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)←[39m
←[90m    at internal/main/run_main_module.js:17:47←[39m
Process finished with exit code 1

Anybody can help me? Thanks^^