From e3c31c69f25ec777f78e440a2c87a93ca0723ef1 Mon Sep 17 00:00:00 2001 From: Szymon Kowalewski <37596854+Szymok@users.noreply.github.com> Date: Wed, 5 Jul 2023 20:41:02 +0200 Subject: [PATCH] Update slow-scan.js - import() function to import the CommonJS module asynchronously workaround to ReferenceError: require is not defined in ES module scope, you can use import instead --- modules/slow-scan.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/slow-scan.js b/modules/slow-scan.js index 53fdc180..11698b65 100755 --- a/modules/slow-scan.js +++ b/modules/slow-scan.js @@ -9,8 +9,10 @@ import path from 'path' import engine from './engine.js' if (process.platform === 'win32') { - const package_path = path.join(path.dirname(require.resolve('geckodriver')), '..') - process.env.PATH = process.env.PATH + ';' + package_path + import('./geckodriver-path.cjs').then((geckodriverPath) => { + const package_path = path.join(geckodriverPath, '..'); + process.env.PATH = process.env.PATH + ';' + package_path; + }); } async function find_username_advanced (req) {