Skip to content
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

REPL with package.json "type":"module" #33369

Open
dilyanpalauzov opened this issue May 12, 2020 · 10 comments
Open

REPL with package.json "type":"module" #33369

dilyanpalauzov opened this issue May 12, 2020 · 10 comments
Labels
repl Issues and PRs related to the REPL subsystem.

Comments

@dilyanpalauzov
Copy link

dilyanpalauzov commented May 12, 2020

Just as having "type":"module" in package.json in the current directory implies that .js files can do import x from 'y', typing node (and then some code) in the directory, where that package.json is, shall also understand import x from 'y'.

In addition there shall be a way to pass a command line switch to node, so that on REPL it understands ES6 import.

@BridgeAR
Copy link
Member

@dilyanpalauzov ideally it should understand both, no matter if "type": "module" is used or not.

@BridgeAR BridgeAR added the repl Issues and PRs related to the REPL subsystem. label May 12, 2020
@dilyanpalauzov
Copy link
Author

I propose also, that node --input-type=module does not print to stderr Cannot specify --input-type for REPL.

@devsnek
Copy link
Member

devsnek commented May 12, 2020

I'm working on adding static imports and such to V8's repl mode, it won't be contingent on mode flags.

@BridgeAR
Copy link
Member

@devsnek do you have the time to look into adding the REPL mode to core as well? This likely needs some work on the VM module and you are probably one of the best to look into that?

@devsnek
Copy link
Member

devsnek commented May 12, 2020

@BridgeAR yeah I can look into it eventually... the main change would probably just be making default eval use Runtime.evaluate

@steeling
Copy link

any update on this?

@Olshansk
Copy link

🏓

@keeganpoppen
Copy link

this would be amazing

@UltiRequiem
Copy link
Contributor

Bump, this would be very cool

@TomasHubelbauer
Copy link

For people who landed here from Google and don't need REPL specifically but --eval will do, check out --input-type=module:

node --input-type=module --eval "import test from './test.js'; console.log(test);"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
repl Issues and PRs related to the REPL subsystem.
Projects
None yet
Development

No branches or pull requests

8 participants