VSCode IntelliSense for commonJS modules using path.join()

137 Views Asked by At

In an Adobe CEP panel that I am working on which also uses NodeJS, I have been using the following approach to require other modules:

require('path');
const moduleA = require(path.join(__dirname, "/*PATH-TO*/module_A.js"));
const moduleB = require(path.join(__dirname, "/*PATH-TO*/module_B.js"));

My problem is that VSCode doesn't parse those files and I am not getting IntelliSense autocomplete after requiring those modules.

Is there a way to make IntelliSense work with such code?

-- Note: That's the only way I could get After-Effects to find those modules, using relative paths gives me errors: Uncaught Error: Cannot find module './module_A'. I have also tried using paths relative to the project folder.

(Alternatively, I would love to know how to make require() work with relative paths in an After-Effects CEP panel, but in this case my project is already full of these requires statements)

0

There are 0 best solutions below