Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Cannot use import statement inside the Node.js REPL, alternatively use dynamic import

$ node

Welcome to Node.js v14.4.0.
Type ".help" for more information.
> let myModule;
undefined
> import("./my-module.js").then(module => { myModule = module });
Promise { <pending> }
> myModule.foo();
"bar"
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #Cannot #import #statement #alternatively #dynamic #import
ADD COMMENT
Topic
Name
8+1 =