Closed as not planned
Description
What is the problem this feature will solve?
Allow import
statements in REPL
What is the feature you are proposing to solve the problem?
Instead of:
> import assert from 'node:assert'
import assert from 'node:assert'
^^^^^^
Uncaught:
SyntaxError: Cannot use import statement inside the Node.js REPL, alternatively use dynamic import
Can we convert them to dynamic import and execute? Just in the REPL.
Like how top level await was supported in Chrome before TLA was an accepted TC39 proposal.
What alternatives have you considered?
At the least we change the message.
from:
Uncaught:
SyntaxError: Cannot use import statement inside the Node.js REPL, alternatively use dynamic import
to:
Uncaught:
SyntaxError: Cannot use import statement inside the Node.js REPL, alternatively use dynamic import
Instead of:
import assert from 'node: assert'
use:
const assert = await import('node: assert')