Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
206 views
in Technique[技术] by (71.8m points)

javascript - How to use absolute/dynamic paths in NodeJs

Would like to use imports by using absolute/dynamic paths, like

import { GlobalVars } from "utils/GlobalVars.js";

but not like

import { GlobalVars } from "../../utils/GlobalVars.js";

With the help of below code snippet able to follow absolute/dynamic path facility in react

jsconfig.json (Which is created at root level of the project)

{
    "compilerOptions": {
        "baseUrl": "src"
    },
    "include": ["src"]
}

with the same code snippet unable to use absolute paths in NodeJs.

Do we have any other approach to use absolute paths in NodeJs or am i doing any mistake

question from:https://stackoverflow.com/questions/65832838/how-to-use-absolute-dynamic-paths-in-nodejs

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...