Currently I use two global variables (__filename
, __dirname
) of node.js
. Now in my code I need to get the name of the project. Is it possible to get via node.js
global variable? Note: I can't directly import package.json
as this is a browser application with webpack
.
Asked
Active
Viewed 188 times
0
-
You can import `package.json` just fine – Webpack will bundle it. – AKX Apr 04 '22 at 09:28
-
I don't think there's a global variable but maybe [this](https://stackoverflow.com/questions/10265798/determine-project-root-from-a-running-node-js-application) will help you – Nik Apr 04 '22 at 09:33