B
B
bpGusar2019-09-13 10:46:56
JavaScript
bpGusar, 2019-09-13 10:46:56

Is it possible to make folders in the project as Node modules?

So that they have easy access and you can get information on methods, etc. of them.
For example:
to access the Books file, you need to write this path

import BooksContr from "../../../DB/controllers/Books";

and then you will get a file and all methods from it will be available in the context menu of hints
, but I would like not to write such a long path, but write like
import BooksContr from "controllers/Books";
and what would be like with the usual import that is presented above.
I found webpack aliases, I use them for a long time, but this not what is needed. They work fine if you want a simple file import, but don't give you access to the content in tooltips.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Osher, 2019-09-13
@miraage

https://webpack.js.org/configuration/resolve/#reso...
Not all editors know how to be friends with such things.
The following recipe works in all JetBrains IDEs:
- right click on desired directory
- mark directory as
- Resource Root

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question