-
Notifications
You must be signed in to change notification settings - Fork 734
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
using shelljs in a JS Module is broken. #1071
Comments
I think you want https://github.com/shelljs/shx/blob/61aca968cd7afc712ca61a4fc4ec3201e3770dc7/src/shx.js#L1 Let me know if that works for you. |
Just tried this out and it seems to work for me: // index.mjs
import shell from 'shelljs';
console.log(shell.ls().stdout); I can run this with: $ node --version
v16.13.1
$ node index.mjs
index.mjs
node_modules
package-lock.json
package.json |
Also have some findings: It depends on the After adding a line in shell.js:
ls is available on the shell object. Seems that the way you // Load all default commands creates this phenomena. |
No change to logic. This documents that we support importing via `import shell from 'shelljs'`. Related to issue #1071, although some more investigation is required to understand why the other syntax doesn't work.
No change to logic. This documents that we support importing via `import shell from 'shelljs'`. Related to issue #1071, although some more investigation is required to understand why the other syntax doesn't work.
Hi please help does anyone have an idea how to add an import module for babel / webpack in electron. In the electron, the module can be added functionally in the following line. But I don't know how to add "require.main.require" to the import. var shell = require.main.require ('shelljs'); Thank you for every thought, I appreciate your work! |
Any update? Even if |
I'm not sure what you're requesting. I think |
nodejs v16.13.2, [email protected], windows
Using shelljs in a JS Module (ES Module) results in a imported shell object with missing functions.
Anyone has found a solution to use shelljs in a ES Module based project ?
The text was updated successfully, but these errors were encountered: