Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

node es6 import

// In order to use imports you must first add "type":"module"
// to your package.json
/* package.json */
{
  "type":"module"
}

/* module.js */
function a() {                                                                                                                          
  console.log('It Works!');                                                                                                             
}                                                                                                                                       
                                                                                                                                        
export { a }

/* index.js */
import { a } from './module.js';
a();
 
PREVIOUS NEXT
Tagged: #node #import
ADD COMMENT
Topic
Name
4+2 =