我对一个路径src做了一个软链,最终目录结构是这样的
--a
----src
--------config.js
----config.json
--b
----src -> ../a/src
----config.json
我在src
目录下的config.js
中有这么一句,var obj = requrie('../config.json');
结果我在b
目录下运行这个js文件,它引入的是文件是a/src/config.json
,我想让其引用b/config.json
,求解决方案。
Soft links are generally not used in development. My understanding is that when deploying or publishing npm packages, the relative reference positions of soft links may not be saved, or there may be many pitfalls in processing.
If you do this, it is best to explain the usage scenario. There may be other ways to solve your needs.