I'm running Windows 10 trying to do local perf test development using Flood Element. I installed Flood Element as per the instructions on the website. I ran the 'element init ...' and 'element generate ...' commands to start with a basic Element test. It runs and passes from the command line, as shown here: basic element test passing from cli
I then add a launch.json file as per the instructions in Setting Up Your Editor, here.
Here is my launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "debug Element - docs",
"type": "node",
"request": "launch",
"args": [
"${workspaceRoot}/node_modules/@flood/element-cli/dist/bin/element.js",
"run",
"./element-basic-project.perf.ts", //path to your test script
"--debug"
]
}
]
}
This generates an error when running from VSCode debugger:
C:\Users\ievans\AppData\Roaming\npm\node.cmd C:\git\element-basic-project/node_modules/@flood/element-cli/dist/bin/element.js run ./element-basic-project.perf.ts --debug
Debugger attached.
Waiting for the debugger to disconnect...
node:internal/modules/cjs/loader:433
throw err;
^
Error: Cannot find module 'C:\git\element-basic-project\node_modules\faker\index.js'. Please verify that the package.json has a valid "main" entry
at tryPackage (node:internal/modules/cjs/loader:425:19)
at Function.Module._findPath (node:internal/modules/cjs/loader:638:18)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1012:27)
at Function.Module._load (node:internal/modules/cjs/loader:871:27)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
I have also tried setting the location of 'element' in the launch.json file to my AppData/Roaming/npm/node_modules/element-cli/bin/element.ts, in which case I get a different error in element.ts:11 about not able to use 'import' from outside of a module.
How can I get basic debugging working for these Flood Element scripts running in VSCode on Windows?