Replies: 1 comment
-
I converted this to a discussion since I don't think there's much we can do on the oclif side to fix this. But I do have one additional workaround that people can consider. The bin/dv.js for the ESM template comes with this hashbang:
If you switch that to a globally installed
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Describe the bug
Running the dev.js script outside the project folder results in the esm-loader failing.
To Reproduce
$ cd ~
$ ./project/oclif-cli-test/bin/dev.js
Expected behavior
The dev script should run regardless of which folder it is invoked in. The non-dev script is not effected, but you must build each time before running the script which is annoying.
Environment (please complete the following information):
Additional context
The solution I found was adding two additional scripts to the bin folder which do a bit of path shenanigans
./bin/devsh
./bin/devsh.js
I believe this is arguably a problem with node and esm_loader, however i rate it as unlikely to be quickly fixed.
The solution above stores the cwd into a env variable, cd's to the project folder to allow module resolution to occur
then sets the process cwd back to the original value before running the application
Beta Was this translation helpful? Give feedback.
All reactions