preveen-stack / nodejs

0 stars 0 forks source link

using mjs for modules #1

Open preveen-stack opened 7 months ago

preveen-stack commented 7 months ago
// myModule.mjs
export const foo = 'bar';
// main.mjs
import { foo } from './myModule.mjs';

console.log("example import module es");
console.log(foo); // Output: bar
sh-3.2$ node main.mjs
example import module es
bar