Node version (or tell us if you're using electron or some other framework):
v12.8.1
ShellJS version (the most recent version/Github branch you see the bug on):
0.8.3
Operating system:
Ubuntu 18.04.3 LTS
Description of the bug:
First of all, thanks for an amazing library, it has been working great for me in all cases I needed it. Apart from today that I tried bundling one of my Node apps.
It would be great if the calls to requires were explicit and not dynamic as it's done at
|
require('./commands').forEach(function (command) { |
|
require('./src/' + command); |
|
}); |
Reason is that when we want to bundle the whole Node application/script into a single JS file, it's impossible to get it to bundle correctly.
One example is something I was trying to do today using Shadow-CLJS; more details at thheller/shadow-cljs#290 (comment)
I tried almost every popular bundler, including @zeit/ncc, Parcel-bundler, Rollup, and finally Webpack.
To be honest, I believe webpack managed to resolve the dynamic requires but then had other issues with __dirname which I use in my code (whole other different issue).
However, it would be much easier to integrate with these bundlers if the requires calls were explicit. Any specific reason why you go through the indirection of array of strings and a loop to require versus the direct require of the commands (other than saving a few characters)?
Thanks
Node version (or tell us if you're using electron or some other framework):
v12.8.1
ShellJS version (the most recent version/Github branch you see the bug on):
0.8.3
Operating system:
Ubuntu 18.04.3 LTS
Description of the bug:
First of all, thanks for an amazing library, it has been working great for me in all cases I needed it. Apart from today that I tried bundling one of my Node apps.
It would be great if the calls to
requireswere explicit and not dynamic as it's done atshelljs/shell.js
Lines 24 to 26 in 57df38c
Reason is that when we want to bundle the whole Node application/script into a single JS file, it's impossible to get it to bundle correctly.
One example is something I was trying to do today using Shadow-CLJS; more details at thheller/shadow-cljs#290 (comment)
I tried almost every popular bundler, including
@zeit/ncc,Parcel-bundler,Rollup, and finallyWebpack.To be honest, I believe
webpackmanaged to resolve the dynamicrequiresbut then had other issues with__dirnamewhich I use in my code (whole other different issue).However, it would be much easier to integrate with these bundlers if the
requirescalls were explicit. Any specific reason why you go through the indirection ofarray of stringsand a loop to require versus the direct require of the commands (other than saving a few characters)?Thanks