Currently we are importing project files with relative paths, which is annoying when we change the location of a file because then we have to update all the relative imports in that file, and nested files requiring modules from src have imports with too many ...
If we start the app with the env variable NODE_PATH=src then we don't need relative imports for the project files and we could for instance import the module in src/randtools.js with require('randtools') from a command module instead of `require('../randtools').
To get this changes to work we need to add NODE_PATH=src to the following scripts in package.json:
dev
dev:console
bot:start
bot:update
bot:restart
test
Also, to get nice autocomplete in VS Code, we need to create a file jsconfig.json in the root of the project with the following configuration:
Currently we are importing project files with relative paths, which is annoying when we change the location of a file because then we have to update all the relative imports in that file, and nested files requiring modules from
src
have imports with too many..
.If we start the app with the env variable
NODE_PATH=src
then we don't need relative imports for the project files and we could for instance import the module insrc/randtools.js
withrequire('randtools')
from a command module instead of `require('../randtools').To get this changes to work we need to add
NODE_PATH=src
to the following scripts inpackage.json
:dev
dev:console
bot:start
bot:update
bot:restart
test
Also, to get nice autocomplete in VS Code, we need to create a file jsconfig.json in the root of the project with the following configuration: